Initial commit
This commit is contained in:
22
src/main/java/io/gmss/infocad/FiscadApplication.java
Executable file
22
src/main/java/io/gmss/infocad/FiscadApplication.java
Executable file
@@ -0,0 +1,22 @@
|
||||
package io.gmss.infocad;
|
||||
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
|
||||
import springfox.documentation.oas.annotations.EnableOpenApi;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableOpenApi
|
||||
@ConfigurationPropertiesScan
|
||||
public class FiscadApplication implements CommandLineRunner {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(FiscadApplication.class, args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
System.out.println("InfoCad Application start completed");
|
||||
}
|
||||
}
|
||||
72
src/main/java/io/gmss/infocad/component/DataLoadConfig.java
Executable file
72
src/main/java/io/gmss/infocad/component/DataLoadConfig.java
Executable file
@@ -0,0 +1,72 @@
|
||||
package io.gmss.infocad.component;
|
||||
|
||||
import io.gmss.infocad.entities.user.Role;
|
||||
import io.gmss.infocad.entities.user.User;
|
||||
import io.gmss.infocad.enums.UserRole;
|
||||
import io.gmss.infocad.repositories.user.RoleRepository;
|
||||
import io.gmss.infocad.repositories.user.UserRepository;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
@Component
|
||||
public class DataLoadConfig {
|
||||
|
||||
private final RoleRepository roleRepository;
|
||||
private final UserRepository userRepository;
|
||||
private final PasswordEncoder passwordEncoder;
|
||||
|
||||
@Value("${app.sourcemind.env.defaultpassword}")
|
||||
private String defaultPassword;
|
||||
|
||||
public DataLoadConfig(RoleRepository roleRepository, UserRepository userRepository, PasswordEncoder passwordEncoder) {
|
||||
this.roleRepository = roleRepository;
|
||||
this.userRepository = userRepository;
|
||||
this.passwordEncoder = passwordEncoder;
|
||||
}
|
||||
|
||||
|
||||
@PostConstruct
|
||||
public void loadData(){
|
||||
loadRoles();
|
||||
loadUsers();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void loadRoles(){
|
||||
|
||||
if(roleRepository.count() > 0) return;
|
||||
Set<Role> roles = new HashSet<>();
|
||||
roles.add(new Role(UserRole.ROLE_USER, "Role attribué aux utilisateurs simples."));
|
||||
roles.add(new Role(UserRole.ROLE_ADMIN, "Role attribué aux administrateurs du système."));
|
||||
roles.add(new Role(UserRole.ROLE_DIRECTEUR, "Role attribué aux directeurs des structures."));
|
||||
roles.add(new Role(UserRole.ROLE_SUPERVISEUR, "Role attribué aux superviseurs des structures sur le terrain."));
|
||||
roles.add(new Role(UserRole.ROLE_ENQUETEUR, "Role attribué aux enquêteurs des structures sur le terrain."));
|
||||
roles.add(new Role(UserRole.ROLE_ANONYMOUS, "Role attribué à toutes les personnes qui s'inscrivent en ligne pour le compte d'une structure."));
|
||||
roleRepository.saveAll(roles);
|
||||
|
||||
}
|
||||
|
||||
public void loadUsers(){
|
||||
if(userRepository.countAllByUsernameIsNotNull() == 0) {
|
||||
User admin = new User();
|
||||
admin.setUsername("administrateur@infocad.bj");
|
||||
admin.setEmail("administrateur@infocad.bj");
|
||||
admin.setTel("N/A");
|
||||
admin.setNom("Administrateur");
|
||||
admin.setPrenom("Principal");
|
||||
admin.setPassword(passwordEncoder.encode(defaultPassword));
|
||||
admin.setActive(true);
|
||||
Set<Role> roles = new HashSet<>();
|
||||
roles.add(roleRepository.findRoleByNom(UserRole.ROLE_ADMIN).get());
|
||||
admin.setRoles(roles);
|
||||
userRepository.save(admin);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
26
src/main/java/io/gmss/infocad/configuration/AuditConfig.java
Executable file
26
src/main/java/io/gmss/infocad/configuration/AuditConfig.java
Executable file
@@ -0,0 +1,26 @@
|
||||
package io.gmss.infocad.configuration;
|
||||
|
||||
|
||||
import io.gmss.infocad.repositories.user.UserRepository;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.domain.AuditorAware;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
|
||||
|
||||
@Configuration
|
||||
@EnableJpaAuditing(auditorAwareRef = "auditorProvider")
|
||||
public class AuditConfig {
|
||||
|
||||
private final UserRepository userRepository;
|
||||
|
||||
public AuditConfig(UserRepository userRepository) {
|
||||
this.userRepository = userRepository;
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public AuditorAware<Long> auditorProvider() {
|
||||
return new AuditorAwareImpl(userRepository);
|
||||
}
|
||||
|
||||
}
|
||||
32
src/main/java/io/gmss/infocad/configuration/AuditorAwareImpl.java
Executable file
32
src/main/java/io/gmss/infocad/configuration/AuditorAwareImpl.java
Executable file
@@ -0,0 +1,32 @@
|
||||
package io.gmss.infocad.configuration;
|
||||
|
||||
import io.gmss.infocad.repositories.user.UserRepository;
|
||||
import io.gmss.infocad.security.UserPrincipal;
|
||||
import org.springframework.data.domain.AuditorAware;
|
||||
import org.springframework.security.authentication.AnonymousAuthenticationToken;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class AuditorAwareImpl implements AuditorAware<Long> {
|
||||
|
||||
private final UserRepository userRepository;
|
||||
|
||||
public AuditorAwareImpl(UserRepository userRepository) {
|
||||
this.userRepository = userRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Long> getCurrentAuditor() {
|
||||
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
|
||||
if(authentication == null || !authentication.isAuthenticated() || authentication instanceof AnonymousAuthenticationToken){
|
||||
return Optional.empty();
|
||||
}
|
||||
UserPrincipal userPrincipal = (UserPrincipal) authentication.getPrincipal();
|
||||
//return userRepository.findByUsername(userPrincipal.getUsername()).get().getId();
|
||||
return Optional.ofNullable(userPrincipal.getUser().getId());
|
||||
}
|
||||
}
|
||||
16
src/main/java/io/gmss/infocad/configuration/JdbcConfig.java
Normal file
16
src/main/java/io/gmss/infocad/configuration/JdbcConfig.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package io.gmss.infocad.configuration;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
@Configuration
|
||||
public class JdbcConfig {
|
||||
@Bean
|
||||
public JdbcTemplate jdbcTemplate(DataSource dataSource)
|
||||
{
|
||||
return new JdbcTemplate(dataSource);
|
||||
}
|
||||
}
|
||||
208
src/main/java/io/gmss/infocad/configuration/SpringSecurityConfig.java
Executable file
208
src/main/java/io/gmss/infocad/configuration/SpringSecurityConfig.java
Executable file
@@ -0,0 +1,208 @@
|
||||
//package io.artcreativity.ifudistribution.config;
|
||||
//
|
||||
//import io.artcreativity.ifudistribution.security.CustomUserDetailsService;
|
||||
//import io.artcreativity.ifudistribution.security.JwtAuthenticationEntryPoint;
|
||||
//import io.artcreativity.ifudistribution.security.JwtAuthenticationFilter;
|
||||
//import org.springframework.context.annotation.Bean;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//import org.springframework.http.HttpMethod;
|
||||
//import org.springframework.security.authentication.AuthenticationManager;
|
||||
//import org.springframework.security.config.BeanIds;
|
||||
//import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
||||
//import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
//import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||
//import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||
//import org.springframework.security.config.http.SessionCreationPolicy;
|
||||
//import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
//import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
//import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
|
||||
//
|
||||
//@EnableWebSecurity
|
||||
//@Configuration
|
||||
//public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
//
|
||||
// private final CustomUserDetailsService customUserDetailsService;
|
||||
// private final JwtAuthenticationEntryPoint jwtAuthenticationEntryPoint;
|
||||
//
|
||||
// public SpringSecurityConfig(CustomUserDetailsService customUserDetailsService, JwtAuthenticationEntryPoint jwtAuthenticationEntryPoint) {
|
||||
// this.customUserDetailsService = customUserDetailsService;
|
||||
// this.jwtAuthenticationEntryPoint = jwtAuthenticationEntryPoint;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void configure(AuthenticationManagerBuilder auth) throws Exception {
|
||||
//// auth.userDetailsService(customUserDetailsService)
|
||||
//// .passwordEncoder(getPasswordEncoder());
|
||||
//
|
||||
// auth
|
||||
// .ldapAuthentication()
|
||||
// .userDnPatterns("uid={0},ou=people")
|
||||
// .groupSearchBase("ou=groups")
|
||||
// .contextSource()
|
||||
// .url("ldap://localhost:5645/dc=artcreativity,dc=io")
|
||||
// .and()
|
||||
// .passwordCompare()
|
||||
// .passwordEncoder(getPasswordEncoder())
|
||||
// .passwordAttribute("userPassword");
|
||||
// }
|
||||
//
|
||||
// @Bean(BeanIds.AUTHENTICATION_MANAGER)
|
||||
// @Override
|
||||
// public AuthenticationManager authenticationManagerBean() throws Exception{
|
||||
// return super.authenticationManagerBean();
|
||||
// }
|
||||
//
|
||||
// @Bean
|
||||
// public PasswordEncoder getPasswordEncoder(){
|
||||
// return new BCryptPasswordEncoder();
|
||||
// }
|
||||
//
|
||||
// @Bean
|
||||
// JwtAuthenticationFilter jwtAuthenticationFilter(){
|
||||
// return new JwtAuthenticationFilter();
|
||||
// }
|
||||
//
|
||||
// private static final String[] AUTH_WHITELIST = {
|
||||
//
|
||||
// // -- swagger ui
|
||||
// "/swagger-resources/**",
|
||||
// "/swagger-ui.html",
|
||||
// "/swagger-ui/**",
|
||||
// "/springfox/**",
|
||||
// "/v3/api-docs",
|
||||
// "/v2/api-docs",
|
||||
// "/webjars/**",
|
||||
// "/api/auth/**",
|
||||
// "/api/contribuable/**",
|
||||
// "/api/auth/login"
|
||||
// };
|
||||
//
|
||||
// @Override
|
||||
// protected void configure(HttpSecurity http) throws Exception {
|
||||
// http
|
||||
// .cors()
|
||||
// .and()
|
||||
// .csrf()
|
||||
// .disable()
|
||||
// .exceptionHandling()
|
||||
// .authenticationEntryPoint(jwtAuthenticationEntryPoint)
|
||||
// .and()
|
||||
//// .sessionManagement()
|
||||
//// .sessionCreationPolicy(SessionCreationPolicy.STATELESS)
|
||||
//// .and()
|
||||
// .authorizeRequests()
|
||||
// .antMatchers("/",
|
||||
// "/favicon.ico",
|
||||
// "/**/*.png",
|
||||
// "/**/*.gif",
|
||||
// "/**/*.svg",
|
||||
// "/**/*.jpg",
|
||||
// "/**/*.html",
|
||||
// "/**/*.css",
|
||||
// "/**/*.js")
|
||||
// .permitAll()
|
||||
// .antMatchers(AUTH_WHITELIST).permitAll()
|
||||
// .antMatchers(HttpMethod.GET, "/api/polls/**", "/api/users/**")
|
||||
// .permitAll()
|
||||
// .anyRequest()
|
||||
// .authenticated();
|
||||
//
|
||||
// http.addFilterBefore(jwtAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class);
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
||||
package io.gmss.infocad.configuration;
|
||||
|
||||
import io.gmss.infocad.security.CustomUserDetailsService;
|
||||
import io.gmss.infocad.security.JwtAuthenticationEntryPoint;
|
||||
import io.gmss.infocad.security.JwtAuthenticationFilter;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.config.BeanIds;
|
||||
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
||||
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||
import org.springframework.security.config.http.SessionCreationPolicy;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
|
||||
|
||||
@EnableWebSecurity
|
||||
@Configuration
|
||||
@EnableGlobalMethodSecurity(securedEnabled = true, jsr250Enabled = true, prePostEnabled = true)
|
||||
public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
|
||||
private final CustomUserDetailsService customUserDetailsService;
|
||||
private final JwtAuthenticationEntryPoint jwtAuthenticationEntryPoint;
|
||||
|
||||
|
||||
public SpringSecurityConfig(CustomUserDetailsService customUserDetailsService,
|
||||
JwtAuthenticationEntryPoint jwtAuthenticationEntryPoint) {
|
||||
this.customUserDetailsService = customUserDetailsService;
|
||||
this.jwtAuthenticationEntryPoint = jwtAuthenticationEntryPoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure(AuthenticationManagerBuilder auth) throws Exception {
|
||||
auth.userDetailsService(customUserDetailsService)
|
||||
.passwordEncoder(getPasswordEncoder());
|
||||
}
|
||||
|
||||
@Bean
|
||||
public PasswordEncoder getPasswordEncoder() {
|
||||
return new BCryptPasswordEncoder();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public JwtAuthenticationFilter jwtAuthenticationFilter() {
|
||||
return new JwtAuthenticationFilter();
|
||||
}
|
||||
|
||||
@Bean(BeanIds.AUTHENTICATION_MANAGER)
|
||||
@Override
|
||||
public AuthenticationManager authenticationManagerBean() throws Exception {
|
||||
return super.authenticationManagerBean();
|
||||
}
|
||||
|
||||
|
||||
private static final String[] AUTH_WHITELIST = {
|
||||
|
||||
// -- CSS and JS
|
||||
"/","/favicon.ico","/**/*.png","/**/*.gif","/**/*.svg","/**/*.jpg","/**/*.html","/**/*.css","/**/*.js",
|
||||
|
||||
// -- swagger ui
|
||||
"/v2/api-docs", "/configuration/**", "/swagger-resources/**", "/swagger-ui.html", "/swagger-ui/**", "/webjars/**", "/api-docs/**", "/springfox/**", "/v3/api-docs",
|
||||
|
||||
// -- Login
|
||||
"/api/**"
|
||||
//"/api/auth/**"
|
||||
};
|
||||
|
||||
@Override
|
||||
public void configure(HttpSecurity http) throws Exception {
|
||||
|
||||
http
|
||||
.cors()
|
||||
.and()
|
||||
.csrf()
|
||||
.disable()
|
||||
.exceptionHandling()
|
||||
.authenticationEntryPoint(jwtAuthenticationEntryPoint)
|
||||
.and()
|
||||
.sessionManagement()
|
||||
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
|
||||
.and()
|
||||
.authorizeRequests()
|
||||
.antMatchers(AUTH_WHITELIST)
|
||||
.permitAll()
|
||||
.anyRequest()
|
||||
.authenticated();
|
||||
|
||||
|
||||
http.addFilterBefore(jwtAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class);
|
||||
}
|
||||
}
|
||||
78
src/main/java/io/gmss/infocad/configuration/SwaggerConfig.java
Executable file
78
src/main/java/io/gmss/infocad/configuration/SwaggerConfig.java
Executable file
@@ -0,0 +1,78 @@
|
||||
package io.gmss.infocad.configuration;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.service.ApiInfo;
|
||||
import springfox.documentation.service.Contact;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.swagger.web.*;
|
||||
|
||||
@Configuration
|
||||
//@Import(SpringDataRestConfiguration.class)
|
||||
public class SwaggerConfig {
|
||||
@Bean
|
||||
public Docket api() {
|
||||
return new Docket(DocumentationType.OAS_30)
|
||||
.select()
|
||||
.apis(RequestHandlerSelectors.basePackage("io.gmss.infocad.controllers")).paths(PathSelectors.any()).build().apiInfo(this.getApiInfo());
|
||||
// .securitySchemes(this.securitySchemes())
|
||||
// .securityContexts(Arrays.asList(this.securityContext()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
// public SecurityContext securityContext() {
|
||||
// AuthorizationScope[] scopes = { new AuthorizationScope("read", "for read operation"),
|
||||
// new AuthorizationScope("write", "for write operation") };
|
||||
// List<SecurityReference> securityReferences = Arrays.asList(new SecurityReference("basicAuth", scopes),
|
||||
// new SecurityReference("Key", scopes), new SecurityReference("Authorization", scopes));
|
||||
// return SecurityContext.builder().securityReferences(securityReferences)
|
||||
// .forPaths(PathSelectors.any())
|
||||
// .build();
|
||||
// }
|
||||
|
||||
// public List<SecurityScheme> securitySchemes() {
|
||||
// // SecurityScheme basicAuth = new BasicAuth("basicAuth");
|
||||
// SecurityScheme userAuthToken = new ApiKey("Authorization", "Authorization", "header");
|
||||
// // SecurityScheme keyAuth = new ApiKey("Key", "Key", "header");
|
||||
// return Arrays.asList(
|
||||
// // keyAuth,
|
||||
// userAuthToken
|
||||
// //, basicAuth
|
||||
// );
|
||||
// }
|
||||
|
||||
@Bean
|
||||
public UiConfiguration uiConfig() {
|
||||
return UiConfigurationBuilder.builder()
|
||||
.deepLinking(true)
|
||||
.displayOperationId(false)
|
||||
.defaultModelsExpandDepth(1)
|
||||
.defaultModelExpandDepth(1)
|
||||
.displayRequestDuration(false)
|
||||
.docExpansion(DocExpansion.LIST) // Use 'LIST', 'FULL', or 'NONE'
|
||||
.filter(false)
|
||||
.maxDisplayedTags(100) // Set the maximum number of tags to display
|
||||
.operationsSorter(OperationsSorter.ALPHA) // Use 'ALPHA' or 'METHOD'
|
||||
.showExtensions(false)
|
||||
.tagsSorter(TagsSorter.ALPHA) // Use 'ALPHA'
|
||||
.validatorUrl(null)
|
||||
.build();
|
||||
}
|
||||
|
||||
private ApiInfo getApiInfo() {
|
||||
Contact contact = new Contact("INFOCAD", "https://gmss.com/", "contact@gmss.com");
|
||||
return new ApiInfoBuilder()
|
||||
.title("LIST OF API")
|
||||
.description("This page show all ressources that you could handle to communicate with database via REST API.")
|
||||
.version("1.0")
|
||||
.license("INFOCAD v.1.0")
|
||||
.licenseUrl("https://www.apache.org/licenses/LICENSE-3.0")
|
||||
.contact(contact)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
21
src/main/java/io/gmss/infocad/configuration/WebConfig.java
Normal file
21
src/main/java/io/gmss/infocad/configuration/WebConfig.java
Normal file
@@ -0,0 +1,21 @@
|
||||
package io.gmss.infocad.configuration;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
@Configuration
|
||||
@EnableWebMvc
|
||||
public class WebConfig implements WebMvcConfigurer {
|
||||
|
||||
private final long MAX_AGE_SECS = 3600;
|
||||
|
||||
@Override
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
registry.addMapping("/**")
|
||||
.allowedOrigins("*")
|
||||
.allowedMethods("HEAD", "OPTIONS", "GET", "POST", "PUT", "PATCH", "DELETE")
|
||||
.maxAge(MAX_AGE_SECS);
|
||||
}
|
||||
}
|
||||
47
src/main/java/io/gmss/infocad/controllers/OpenController.java
Executable file
47
src/main/java/io/gmss/infocad/controllers/OpenController.java
Executable file
@@ -0,0 +1,47 @@
|
||||
package io.gmss.infocad.controllers;
|
||||
|
||||
import net.sf.jasperreports.engine.JasperCompileManager;
|
||||
import net.sf.jasperreports.engine.JasperReport;
|
||||
import net.sf.jasperreports.engine.util.JRSaver;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/open", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public class OpenController {
|
||||
|
||||
@Value("${file.jasper-reports}")
|
||||
private String jaspersDir;
|
||||
|
||||
@GetMapping("/compile-report")
|
||||
public ResponseEntity<?> compile(@RequestParam String jrxmlFileName) {
|
||||
try{
|
||||
InputStream quitusReportStream = getStream(jaspersDir + "/" + jrxmlFileName + ".jrxml");
|
||||
JasperReport jasperReport = JasperCompileManager.compileReport(quitusReportStream);
|
||||
JRSaver.saveObject(jasperReport, jaspersDir + "/" + jrxmlFileName + ".jasper");
|
||||
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private InputStream getStream(String fileName) throws IOException {
|
||||
File initialFile = new File(fileName);
|
||||
InputStream stream = new FileInputStream(initialFile);
|
||||
return stream;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package io.gmss.infocad.controllers.decoupage;
|
||||
|
||||
|
||||
import io.gmss.infocad.entities.decoupage.Arrondissement;
|
||||
import io.gmss.infocad.exceptions.NotFoundException;
|
||||
import io.gmss.infocad.interfaces.decoupage.ArrondissementService;
|
||||
import io.gmss.infocad.paylaods.ApiResponse;
|
||||
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 javax.validation.Valid;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/arrondissement", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public class ArrondissementController {
|
||||
|
||||
private final ArrondissementService arrondissementService;
|
||||
|
||||
public ArrondissementController(ArrondissementService arrondissementService) {
|
||||
this.arrondissementService = arrondissementService;
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createArrondissement(@RequestBody @Valid @Validated Arrondissement arrondissement) {
|
||||
try{
|
||||
arrondissement = arrondissementService.createArrondissement(arrondissement);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, arrondissement, "Arrondissement créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
public ResponseEntity<?> updateArrondissement(@PathVariable Long id, @RequestBody Arrondissement arrondissement) {
|
||||
try{
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, arrondissementService.updateArrondissement(id, arrondissement), "Arrondissement mis à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ResponseEntity<?> deleteArrondissement(@PathVariable Long id) {
|
||||
try{
|
||||
arrondissementService.deleteArrondissement(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,"Arrondissement supprimée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<?> getAllArrondissementList() {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, arrondissementService.getArrondissementList(), "Liste des arrondissements chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/all-paged")
|
||||
public ResponseEntity<?> getAllArrondissementPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, arrondissementService.getArrondissementList(pageable), "Liste des arrondissements chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/id/{id}")
|
||||
public ResponseEntity<?> getArrondissementById(@PathVariable Long id) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, arrondissementService.getArrondissementById(id), "Arrondissement trouvé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/commune/{communeId}")
|
||||
public ResponseEntity<?> getArrondissementByCommune(@PathVariable Long communeId) {
|
||||
|
||||
try{
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, arrondissementService.getArrondissementByComune(communeId), "Liste des arrondissements par commune chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (NotFoundException e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package io.gmss.infocad.controllers.decoupage;
|
||||
|
||||
|
||||
import io.gmss.infocad.entities.decoupage.Commune;
|
||||
import io.gmss.infocad.exceptions.NotFoundException;
|
||||
import io.gmss.infocad.interfaces.decoupage.CommuneService;
|
||||
import io.gmss.infocad.paylaods.ApiResponse;
|
||||
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 javax.validation.Valid;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/commune", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public class CommuneController {
|
||||
|
||||
private final CommuneService communeService;
|
||||
|
||||
public CommuneController(CommuneService communeService) {
|
||||
this.communeService = communeService;
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createCommune(@RequestBody @Valid @Validated Commune commune) {
|
||||
try{
|
||||
commune = communeService.createCommune(commune);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, commune, "Commune créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
public ResponseEntity<?> updateCommune(@PathVariable Long id, @RequestBody Commune commune) {
|
||||
try{
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, communeService.updateCommune(id, commune), "Commune mis à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ResponseEntity<?> deleteCommuner(@PathVariable Long id) {
|
||||
try{
|
||||
communeService.deleteCommune(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,"Commune supprimée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<?> getAllCommuneList() {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, communeService.getCommuneList(), "Liste des communes chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/all-paged")
|
||||
public ResponseEntity<?> getAllCommunePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, communeService.getCommuneList(pageable), "Liste des communes chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/id/{id}")
|
||||
public ResponseEntity<?> getCommuneById(@PathVariable Long id) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, communeService.getCommuneById(id), "Commune trouvée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/departement/{departementId}")
|
||||
public ResponseEntity<?> getCommuneByDepartement(@PathVariable Long departementId) {
|
||||
|
||||
try{
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, communeService.getCommunesByDepartement(departementId), "Liste des communes par département chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (NotFoundException e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package io.gmss.infocad.controllers.decoupage;
|
||||
|
||||
|
||||
import io.gmss.infocad.entities.decoupage.Departement;
|
||||
import io.gmss.infocad.interfaces.decoupage.DepartementService;
|
||||
import io.gmss.infocad.paylaods.ApiResponse;
|
||||
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 javax.validation.Valid;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/departement", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public class DepartementController {
|
||||
|
||||
private final DepartementService departementService;
|
||||
|
||||
public DepartementController(DepartementService departementService) {
|
||||
this.departementService = departementService;
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createDepartement(@RequestBody @Valid @Validated Departement departement) {
|
||||
try{
|
||||
departement = departementService.createDepartement(departement);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, departement, "Departement créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
public ResponseEntity<?> updateDepartement(@PathVariable Long id, @RequestBody Departement departement) {
|
||||
try{
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, departementService.updateDepartement(id, departement), "Département mis à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ResponseEntity<?> deleteDepartementr(@PathVariable Long id) {
|
||||
try{
|
||||
departementService.deleteDepartement(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,"Département supprimé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<?> getAllDepartementList() {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, departementService.getDepartementList(), "Liste des département chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/all-paged")
|
||||
public ResponseEntity<?> getAllDepartementPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, departementService.getDepartementList(pageable), "Liste des département chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/id/{id}")
|
||||
public ResponseEntity<?> getDepartementById(@PathVariable Long id) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, departementService.getDepartementById(id), "Département trouvé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package io.gmss.infocad.controllers.decoupage;
|
||||
|
||||
|
||||
import io.gmss.infocad.entities.decoupage.Nationalite;
|
||||
import io.gmss.infocad.interfaces.decoupage.NationaliteService;
|
||||
import io.gmss.infocad.paylaods.ApiResponse;
|
||||
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 javax.validation.Valid;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/nationalite", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public class NationaliteController {
|
||||
|
||||
private final NationaliteService nationaliteService;
|
||||
|
||||
public NationaliteController(NationaliteService nationaliteService) {
|
||||
this.nationaliteService = nationaliteService;
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createNationalite(@RequestBody @Valid @Validated Nationalite nationalite) {
|
||||
try{
|
||||
nationalite = nationaliteService.createNationalite(nationalite);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, nationalite, "Nationalite créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
public ResponseEntity<?> updateNationalite(@PathVariable Long id, @RequestBody Nationalite nationalite) {
|
||||
try{
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, nationaliteService.updateNationalite(id, nationalite), "Nationalités mis à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ResponseEntity<?> deleteNationaliter(@PathVariable Long id) {
|
||||
try{
|
||||
nationaliteService.deleteNationalite(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,"Nationalités supprimé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<?> getAllNationaliteList() {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, nationaliteService.getNationaliteList(), "Liste des nationalités chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/all-paged")
|
||||
public ResponseEntity<?> getAllNationalitePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, nationaliteService.getNationaliteList(pageable), "Liste des nationalités chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/id/{id}")
|
||||
public ResponseEntity<?> getNationaliteById(@PathVariable Long id) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, nationaliteService.getNationaliteById(id), "Nationalités trouvées avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package io.gmss.infocad.controllers.decoupage;
|
||||
|
||||
|
||||
import io.gmss.infocad.entities.decoupage.Quartier;
|
||||
import io.gmss.infocad.exceptions.NotFoundException;
|
||||
import io.gmss.infocad.interfaces.decoupage.QuartierService;
|
||||
import io.gmss.infocad.paylaods.ApiResponse;
|
||||
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 javax.validation.Valid;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/quartier", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public class QuartierController {
|
||||
|
||||
private final QuartierService quartierService;
|
||||
|
||||
public QuartierController(QuartierService quartierService) {
|
||||
this.quartierService = quartierService;
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createQuartier(@RequestBody @Valid @Validated Quartier quartier) {
|
||||
try{
|
||||
quartier = quartierService.createQuartier(quartier);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, quartier, "Quartier créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
public ResponseEntity<?> updateQuartier(@PathVariable Long id, @RequestBody Quartier quartier) {
|
||||
try{
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, quartierService.updateQuartier(id, quartier), "Quartier mis à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ResponseEntity<?> deleteQuartier(@PathVariable Long id) {
|
||||
try{
|
||||
quartierService.deleteQuartier(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,"Quartier supprimé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<?> getAllQuartierList() {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, quartierService.getQuartierList(), "Liste des quartiers chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/all-paged")
|
||||
public ResponseEntity<?> getAllQuartierPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, quartierService.getQuartierList(pageable), "Liste des quartiers chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/id/{id}")
|
||||
public ResponseEntity<?> getQuartierById(@PathVariable Long id) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, quartierService.getQuartierById(id), "Quartier trouvé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/arrondissement/{arrondissementId}")
|
||||
public ResponseEntity<?> getQuartierByArrondissement(@PathVariable Long arrondissementId) {
|
||||
|
||||
try{
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, quartierService.getQuartierByArrondissement(arrondissementId), "Liste des quartiers par commune chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (NotFoundException e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package io.gmss.infocad.controllers.infocad.metier;
|
||||
|
||||
import io.gmss.infocad.interfaces.infocad.metier.ActeurConcerneService;
|
||||
import io.gmss.infocad.paylaods.ApiResponse;
|
||||
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/acteur-concerne", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public class ActeurConcerneController {
|
||||
|
||||
private final ActeurConcerneService acteurConcerneService;
|
||||
|
||||
public ActeurConcerneController(ActeurConcerneService acteurConcerneService) {
|
||||
this.acteurConcerneService = acteurConcerneService;
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/id/{id}")
|
||||
public ResponseEntity<?> getArrondissementById(@PathVariable Long id) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, acteurConcerneService.getActeurConcerneById(id).get(), "Arrondissement trouvé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
package io.gmss.infocad.controllers.infocad.metier;
|
||||
|
||||
|
||||
import io.gmss.infocad.entities.infocad.metier.Bloc;
|
||||
import io.gmss.infocad.interfaces.infocad.metier.BlocService;
|
||||
import io.gmss.infocad.paylaods.ApiResponse;
|
||||
import io.gmss.infocad.security.CurrentUser;
|
||||
import io.gmss.infocad.security.UserPrincipal;
|
||||
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 javax.validation.Valid;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/bloc", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public class BlocController {
|
||||
|
||||
private final BlocService blocService;
|
||||
|
||||
public BlocController(BlocService blocService) {
|
||||
this.blocService = blocService;
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createBloc(@RequestBody @Valid @Validated Bloc bloc, @CurrentUser UserPrincipal userPrincipal) {
|
||||
try{
|
||||
bloc = blocService.createBloc(bloc);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, bloc, "Bloc créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
public ResponseEntity<?> updateBloc(@PathVariable Long id, @RequestBody Bloc bloc) {
|
||||
try{
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, blocService.updateBloc(id, bloc), "Bloc mis à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ResponseEntity<?> deleteBlocr(@PathVariable Long id) {
|
||||
try{
|
||||
blocService.deleteBloc(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,"Bloc supprimé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<?> getAllBlocList() {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, blocService.getBlocList(), "Liste des blocs chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/list-by-arrondissement")
|
||||
public ResponseEntity<?> getAllBlocListByArrondissement(@RequestParam Long idArrondissement) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, blocService.getBlocsByArrondissement(idArrondissement), "Liste des blocs chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/list-by-structure")
|
||||
public ResponseEntity<?> getAllBlocListByStructure(@RequestParam Long idStructure) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, blocService.getBlocsByStructure(idStructure), "Liste des blocs chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/all-paged")
|
||||
public ResponseEntity<?> getAllBlocPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, blocService.getBlocList(pageable), "Liste des blocs chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/id/{id}")
|
||||
public ResponseEntity<?> getBlocById(@PathVariable Long id) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, blocService.getBlocById(id), "Bloc trouvé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
package io.gmss.infocad.controllers.infocad.metier;
|
||||
|
||||
|
||||
import io.gmss.infocad.entities.infocad.metier.Commentaire;
|
||||
import io.gmss.infocad.interfaces.infocad.metier.CommentaireService;
|
||||
import io.gmss.infocad.paylaods.ApiResponse;
|
||||
import io.gmss.infocad.paylaods.request.CommentaireRequest;
|
||||
import io.gmss.infocad.paylaods.request.SyncCommentaireRequest;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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 javax.validation.Valid;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/commentaire", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public class CommentaireController {
|
||||
|
||||
private final CommentaireService commentaireService;
|
||||
|
||||
public CommentaireController(CommentaireService commentaireService) {
|
||||
this.commentaireService = commentaireService;
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createcommentaire(@RequestBody @Valid @Validated Commentaire commentaire) {
|
||||
try{
|
||||
commentaire.setDateCommentaire(LocalDateTime.now());
|
||||
commentaire = commentaireService.createCommentaire(commentaire);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, commentaire, "Commentaire créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
public ResponseEntity<?> updatecommentaire(@PathVariable Long id, @RequestBody Commentaire commentaire) {
|
||||
try{
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, commentaireService.updateCommentaire(id, commentaire), "commentaire mis à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ResponseEntity<?> deletecommentaire(@PathVariable Long id) {
|
||||
try{
|
||||
commentaireService.deleteCommentaire(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,"Commentaire supprimé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<?> getAllcommentaireList() {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, commentaireService.getCommentaireList(), "Liste des commentaires chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/id/{id}")
|
||||
public ResponseEntity<?> getcommentaireById(@PathVariable Long id) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, commentaireService.getCommentaireById(id), "commentaire trouvée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/nup/{nup}")
|
||||
public ResponseEntity<?> getcommentaireByNup(@PathVariable String nup) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, commentaireService.getCommentaireByNup(nup), "commentaire trouvée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@PostMapping("/enquete")
|
||||
public ResponseEntity<?> getcommentaireByEnquete(@RequestBody Commentaire commentaire) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, commentaireService.getCommentairesByEnqueteAndTerminal(commentaire.getIdEnquete(), commentaire.getTerminalId()), "Liste des commentaires chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@PostMapping("/enquete-and-state")
|
||||
@ApiOperation(value = "Cette ressource permet d'avoir la liste de tous les commentaires d'une enquête avec le statut (lu ou non lu). Les champs a renseigner pour le payload sont idEnquete et lu")
|
||||
public ResponseEntity<?> getcommentaireByEnqueteAndStatut(@RequestBody Commentaire commentaire) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, commentaireService.getCommentairesByEnqueteAndLu(commentaire.getIdEnquete(), commentaire.isLu()), "Liste des commentaires chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@PostMapping("/all-by-params")
|
||||
@ApiOperation(value = "Cette ressource permet d'avoir 4 résultats différents. \n 1 - Liste des commentaires non lus provenant du Web. \n 2 - Liste des commentaires lus provenant du Web \n 3 - Liste des commentaires non lus provenant du mobile. \n 4 - Liste des commentaires lus provenant du mobile. \n A savoir : Les variables Origine et lu sont à varier pour avoir le résultat")
|
||||
public ResponseEntity<?> getcommentaireByParams(@RequestBody CommentaireRequest commentaireRequest) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, commentaireService.getCommentairesByOrigineAndStateReadAndTerminalId(commentaireRequest.getOrigine(), commentaireRequest.isLu(), commentaireRequest.getTerminalId()), "Liste des commentaires chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@PostMapping("synchronise/from-mobile")
|
||||
@ApiOperation(value = "Cette ressource permet de synchroniser tous les commentaires effectués sur le mobile vers le backend.")
|
||||
public ResponseEntity<?> synchroniseCommentairesFromMobile(@RequestBody List<Commentaire> commentaires) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, commentaireService.saveAllCommentairesFromMobile(commentaires), "Liste des commentaires synchronisée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@PostMapping("synchronise/from-web")
|
||||
@ApiOperation(value = "Cette ressource permet d'avoir 4 résultats différents. \n 1 - Liste des commentaires non synchronisés provenant du Web. \n 2 - Liste des commentaires synchronisés provenant du Web \n 3 - Liste des commentaires non synchronisés provenant du mobile. \n 4 - Liste des commentaires synchronisés provenant du mobile. \n A savoir : Les variables Origine et Synchronise sont à varier pour avoir le résultat")
|
||||
public ResponseEntity<?> synchroniseCommentairesFromWeb(@RequestBody CommentaireRequest commentaireRequest) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, commentaireService.getCommentairesByOrigineAndStateSynchronizedAndTerminalId(commentaireRequest.getOrigine(), commentaireRequest.isSynchronise(), commentaireRequest.getTerminalId()), "Liste des commentaires chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@PostMapping("synchronise/notify-done-from-mobile")
|
||||
@ApiOperation(value = "Cette ressource permet matérialiser coté backend les commentaires du WEB déjà synchronisé avec le MOBILE pour que les prochaines extractions ne prennent pas en compte cela. ")
|
||||
public ResponseEntity<?> notifyDoneSynchronizedFromMobile(@RequestBody List<SyncCommentaireRequest> syncCommentaireRequests) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, commentaireService.notifySynchronizedDoneFromMobile(syncCommentaireRequests), "Synchronisation terminée."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,190 @@
|
||||
package io.gmss.infocad.controllers.infocad.metier;
|
||||
|
||||
import io.gmss.infocad.interfaces.infocad.metier.EnqueteService;
|
||||
import io.gmss.infocad.paylaods.ApiResponse;
|
||||
import io.gmss.infocad.paylaods.request.EnquetePayLoad;
|
||||
import io.gmss.infocad.paylaods.request.EnqueteTraitementPayLoad;
|
||||
import io.gmss.infocad.paylaods.request.FiltreEnquetePayLoad;
|
||||
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 javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/enquete", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public class EnqueteController {
|
||||
|
||||
private final EnqueteService enqueteService ;
|
||||
|
||||
public EnqueteController(EnqueteService enqueteService) {
|
||||
this.enqueteService = enqueteService;
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createStructure(@RequestBody @Valid @Validated EnquetePayLoad enquetePayLoad) {
|
||||
// try{
|
||||
// enquete = enqueteService.createEnquete(enquete);
|
||||
// return new ResponseEntity<>(
|
||||
// new ApiResponse<>(true, structure, "Structure créé avec succès."),
|
||||
// HttpStatus.OK
|
||||
// );
|
||||
// }catch (Exception e){
|
||||
// return new ResponseEntity<>(
|
||||
// new ApiResponse<>(false, e.getMessage()),
|
||||
// HttpStatus.OK
|
||||
// );
|
||||
// }
|
||||
return null;
|
||||
}
|
||||
|
||||
@PutMapping("/validation")
|
||||
public ResponseEntity<?> validerEnquete(@RequestBody EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
try{
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteService.validerEnquete(enqueteTraitementPayLoad), "Validation effectuée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false,"Impossible de valider l'enquête : "+e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/rejet")
|
||||
public ResponseEntity<?> rejeterEnquete(@RequestBody EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
try{
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteService.rejeterEnquete(enqueteTraitementPayLoad), "Rejet effectuée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false,"Impossible de valider l'enquête : "+e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/validation-lot")
|
||||
public ResponseEntity<?> validerEnqueteParLot(@RequestBody List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
try{
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteService.validerEnquete(enqueteTraitementPayLoads), "Validation effectuée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false,"Impossible de valider l'enquête : " + e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/rejet-lot")
|
||||
public ResponseEntity<?> rejeterEnqueteParLot(@RequestBody List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
try{
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteService.rejeterEnquete(enqueteTraitementPayLoads), "Rejet effectuée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false,"Impossible de valider l'enquête : "+e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all/decoupage-admin-for-enquete")
|
||||
public ResponseEntity<?> getAllByEnqueteDecoupageAdmin() {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteService.getDecoupageAdminUserConnecterAndStat(), "Liste des enquetes chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ResponseEntity<?> deleteStructurer(@PathVariable Long id) {
|
||||
try{
|
||||
enqueteService.deleteEnquete(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,"enquete supprimée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<?> getAllStructureList() {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteService.getEnqueteList(), "Liste des enquetes chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/all/com-arrond-bloc")
|
||||
public ResponseEntity<?> getAllByCommuneArrondBloc() {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteService.getEnqueteCommuneArrondBloc(), "Liste des enquetes chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@PostMapping("/all/com-arrond-bloc/filtre")
|
||||
public ResponseEntity<?> getAllByCommuneArrondBlocFiltre(@RequestBody FiltreEnquetePayLoad filtreEnquetePayLoad) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteService.getEnqueteCommuneArrondBlocFiltre(filtreEnquetePayLoad), "Liste des enquetes chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/all-paged")
|
||||
public ResponseEntity<?> getAllEnquetePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteService.getEnqueteList(pageable), "Liste des enquetes chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/fiche/id/{id}")
|
||||
public ResponseEntity<?> getFicheEnqueteById(@PathVariable Long id) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteService.getFicheEnquete(id), "enquete trouvé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/id/{id}")
|
||||
public ResponseEntity<?> getStructureById(@PathVariable Long id) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteService.getEnqueteById(id), "enquete trouvé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/traiter-non-synch-to-mobile/{terminalId}")
|
||||
public ResponseEntity<?> getEnqueteValideNonSynch(@PathVariable Long terminalId) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteService.getEnqueteValideNonSynch(terminalId), "Liste des enquetes traitées non synchronisées sur le termianl."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
package io.gmss.infocad.controllers.infocad.metier;
|
||||
|
||||
|
||||
import io.gmss.infocad.entities.infocad.metier.Tpe;
|
||||
import io.gmss.infocad.interfaces.infocad.metier.TpeService;
|
||||
import io.gmss.infocad.paylaods.ApiResponse;
|
||||
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 javax.validation.Valid;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/tpe", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public class TpeController {
|
||||
|
||||
private final TpeService tpeService;
|
||||
|
||||
public TpeController(TpeService tpeService) {
|
||||
this.tpeService = tpeService;
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createTpe(@RequestBody @Valid @Validated Tpe tpe) {
|
||||
try{
|
||||
tpe = tpeService.createTpe(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) {
|
||||
try{
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, tpeService.updateTpe(id, tpe), "Tpe mis à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ResponseEntity<?> deleteTper(@PathVariable Long id) {
|
||||
try{
|
||||
tpeService.deleteTpe(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,"Tpe supprimé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<?> getAllTpeList() {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, tpeService.getTpeList(), "Liste des tpe chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/all-by-model/{model}")
|
||||
public ResponseEntity<?> getAllTpeListByModel(@PathVariable String model) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, tpeService.getTpeListByModel(model), "Liste des tpe chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/all-by-userId/{userId}")
|
||||
public ResponseEntity<?> getAllTpeListByUserId(@PathVariable Long userId) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, tpeService.getTpeListByUserId(userId), "Liste des tpe de l'utilisateurs."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/all-paged")
|
||||
public ResponseEntity<?> getAllTpePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, tpeService.getTpeList(pageable), "Liste des tpe chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/id/{id}")
|
||||
public ResponseEntity<?> getTpeById(@PathVariable Long id) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, tpeService.getTpeById(id), "Tpe trouvé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/identifier/{identifier}")
|
||||
public ResponseEntity<?> getTpeByIdentifier(@PathVariable String identifier) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, tpeService.getTepByIdentifier(identifier), "Tpe trouvé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,232 @@
|
||||
package io.gmss.infocad.controllers.infocad.metier;
|
||||
|
||||
import io.gmss.infocad.entities.infocad.metier.Upload;
|
||||
import io.gmss.infocad.paylaods.ApiResponse;
|
||||
import io.gmss.infocad.repositories.infocad.metier.UploadRepository;
|
||||
import io.gmss.infocad.service.FileStorageService;
|
||||
import io.gmss.infocad.service.StringManager;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.Data;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
/**
|
||||
* @author AKAKPO Aurince
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(value = "/api/upload", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Api(value = "Uploads controllers", description = "API for accessing to uploads files details.", tags = {"Uploads"})
|
||||
@CrossOrigin(origins = "*", maxAge = 3600)
|
||||
@Data
|
||||
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;
|
||||
|
||||
// @Autowired
|
||||
// private ActeurRepository proprietaireRepository;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private int firstLineColumnNumber = 0;
|
||||
private String fileHeader;
|
||||
private String fileHeaderType;
|
||||
private int anneeFiscale;
|
||||
private int indiceOfFile = 0;
|
||||
|
||||
|
||||
|
||||
private SimpleDateFormat sdf = new SimpleDateFormat("YYYYMMDD");
|
||||
private DateTimeFormatter formatter = DateTimeFormatter.ofPattern("YYYYMMDD");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@GetMapping("/all")
|
||||
@ApiOperation(value = "List of uploads files.")
|
||||
public ResponseEntity<?> all() {
|
||||
try {
|
||||
if (uploadRepository.findAll().isEmpty()) {
|
||||
return new ResponseEntity<>(new ApiResponse(true, uploadRepository.findAll(), "Empty list. No values present."), HttpStatus.OK);
|
||||
} else {
|
||||
return new ResponseEntity<>(new ApiResponse(true, uploadRepository.findAll(), "All uploads files founded."), HttpStatus.OK);
|
||||
}
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
return new ResponseEntity<>(new ApiResponse(false,null, "Method POST/GET is required."), 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/proprietaireid/{proprietaireid}")
|
||||
// @ApiOperation(value = "List des fichiers d'un proprietaire.")
|
||||
// public ResponseEntity<?> allByActeurId(@PathVariable Long proprietaireid) {
|
||||
// try {
|
||||
// List<Upload> uploads=uploadRepository.findAllByActeur_Id(proprietaireid);
|
||||
// if (uploads.isEmpty()) {
|
||||
// return new ResponseEntity<>(new ApiResponse(true, "Empty list. No values present.", HttpStatus.NOT_FOUND, uploads), HttpStatus.OK);
|
||||
// } else {
|
||||
// return new ResponseEntity<>(new ApiResponse(true, "All uploads files founded.", HttpStatus.OK, uploadRepository.findAll()), HttpStatus.OK);
|
||||
// }
|
||||
// } catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
// return new ResponseEntity<>(new ApiResponse(false, "Method POST/GET is required.", HttpStatus.METHOD_NOT_ALLOWED, null), HttpStatus.OK);
|
||||
// } catch (NullPointerException e) {
|
||||
// logger.error(e.getLocalizedMessage());
|
||||
// return new ResponseEntity<>(new ApiResponse(false, "Null value has been detected {" + e.getMessage() + "}.", HttpStatus.BAD_REQUEST, null), HttpStatus.OK);
|
||||
// } catch (Exception e) {
|
||||
// logger.error(e.getLocalizedMessage());
|
||||
// return new ResponseEntity<>(new ApiResponse(false, "An error has been occur and the content is {" + e.getMessage() + "}.", HttpStatus.INTERNAL_SERVER_ERROR, null), HttpStatus.OK);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
@GetMapping("/id/{id}")
|
||||
@ApiOperation(value = "Get one upload by his id.")
|
||||
public ResponseEntity<?> one(@PathVariable Long id) {
|
||||
|
||||
try {
|
||||
if (uploadRepository.findById(id).isPresent()) {
|
||||
return new ResponseEntity<>(new ApiResponse(true, uploadRepository.getOne(id), "File with id {" + id + "} is found."), HttpStatus.OK);
|
||||
} else {
|
||||
return new ResponseEntity<>(new ApiResponse(true, null,"The upload with id {" + id + "} you request for is not found."), HttpStatus.OK);
|
||||
}
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
return new ResponseEntity<>(new ApiResponse(false,null, "Method POST/GET is required."), 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param fileName
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "This resource is used to download one file from server.")
|
||||
@GetMapping("/downloadFile/{fileName:.+}")
|
||||
public ResponseEntity<Resource> downloadFile(@PathVariable String fileName, HttpServletRequest request) {
|
||||
// Load file as Resource
|
||||
Resource resource = fileStorageService.loadFileAsResource(fileName);
|
||||
|
||||
// Try to determine file's content type
|
||||
String contentType = null;
|
||||
try {
|
||||
contentType = request.getServletContext().getMimeType(resource.getFile().getAbsolutePath());
|
||||
} catch (IOException ex) {
|
||||
logger.info("Could not determine file type.");
|
||||
}
|
||||
|
||||
// Fallback to the default content type if type could not be determined
|
||||
if (contentType == null) {
|
||||
contentType = "application/octet-stream";
|
||||
}
|
||||
|
||||
return ResponseEntity.ok()
|
||||
.contentType(MediaType.parseMediaType(contentType))
|
||||
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + resource.getFilename() + "\"")
|
||||
.body(resource);
|
||||
}
|
||||
|
||||
@PostMapping("/save")
|
||||
@ApiOperation(value = "Add one upload.")
|
||||
public ResponseEntity<?> save(@RequestPart(required = true) MultipartFile file , @RequestParam String reference,@RequestParam String description /*, @RequestParam Long idTypeUpload*/) {
|
||||
|
||||
try {
|
||||
Upload upload = new Upload();
|
||||
// Optional<TypeUpload> optionalTypeUpload=typeUploadRepository.findById(1L);
|
||||
// if(optionalTypeUpload.isPresent()){
|
||||
// upload.setTypeUpload(optionalTypeUpload.get());
|
||||
// }else {
|
||||
// return new ResponseEntity<>(new ApiResponse(false, "Ce type de document n'est pas autorisé", HttpStatus.BAD_REQUEST, null), HttpStatus.OK);
|
||||
// }
|
||||
// Optional<Acteur> optionalActeur = proprietaireRepository.findById(idActeur);
|
||||
// if (optionalActeur.isPresent()) {
|
||||
// upload.setActeur(optionalActeur.get());
|
||||
// }
|
||||
String fileName = fileStorageService.storeFile(file);
|
||||
upload.setFileName(fileName);
|
||||
upload.setMimeType(file.getContentType());
|
||||
upload.setSize(file.getSize());
|
||||
upload.setOriginalFileName(file.getOriginalFilename());
|
||||
return new ResponseEntity<>(new ApiResponse(true,uploadRepository.save(upload), "File has been created successfully."), HttpStatus.OK);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
return new ResponseEntity<>(new ApiResponse(false,null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
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/{id}")
|
||||
@ApiOperation(value = "Delete one upload.")
|
||||
public ResponseEntity<?> delete(@PathVariable Long id) {
|
||||
try {
|
||||
if (id != null || uploadRepository.findById(id).isPresent()) {
|
||||
String name = uploadRepository.getOne(id).getFileName();
|
||||
fileStorageService.deleteFile(name);
|
||||
uploadRepository.deleteById(id);
|
||||
return new ResponseEntity<>(new ApiResponse(true,null, "File with name {" + name + "} has been deleted successfully."), HttpStatus.OK);
|
||||
} else {
|
||||
return new ResponseEntity<>(new ApiResponse(true,null, "The upload specified in your request body is not found."), HttpStatus.OK);
|
||||
}
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
return new ResponseEntity<>(new ApiResponse(false,null, "Method POST/GET is required."), 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,98 @@
|
||||
package io.gmss.infocad.controllers.infocad.parametre;
|
||||
|
||||
|
||||
import io.gmss.infocad.entities.infocad.parametre.ModeAcquisition;
|
||||
import io.gmss.infocad.interfaces.infocad.parametre.ModeAcquisitionService;
|
||||
import io.gmss.infocad.paylaods.ApiResponse;
|
||||
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 javax.validation.Valid;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/mode-acquisition", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public class ModeAcquisitionController {
|
||||
|
||||
private final ModeAcquisitionService modeAcquisitionService;
|
||||
|
||||
public ModeAcquisitionController(ModeAcquisitionService modeAcquisitionService) {
|
||||
this.modeAcquisitionService = modeAcquisitionService;
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createModeAcquisition(@RequestBody @Valid @Validated ModeAcquisition modeAcquisition) {
|
||||
try{
|
||||
modeAcquisition = modeAcquisitionService.createModeAcquisition(modeAcquisition);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, modeAcquisition, "Mode acquisition créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
public ResponseEntity<?> updateModeAcquisition(@PathVariable Long id, @RequestBody ModeAcquisition modeAcquisition) {
|
||||
try{
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, modeAcquisitionService.updateModeAcquisition(id, modeAcquisition), "Mode d'acquisition mis à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ResponseEntity<?> deleteModeAcquisitionr(@PathVariable Long id) {
|
||||
try{
|
||||
modeAcquisitionService.deleteModeAcquisition(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,"Mode d'acquisition supprimé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<?> getAllModeAcquisitionList() {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, modeAcquisitionService.getModeAcquisitionList(), "Liste des modes d'acquisitions chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/all-paged")
|
||||
public ResponseEntity<?> getAllModeAcquisitionPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, modeAcquisitionService.getModeAcquisitionList(pageable), "Liste des modes d'acquisitions chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/id/{id}")
|
||||
public ResponseEntity<?> getModeAcquisitionById(@PathVariable Long id) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, modeAcquisitionService.getModeAcquisitionById(id), "Mode d'acquisition trouvé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package io.gmss.infocad.controllers.infocad.parametre;
|
||||
|
||||
|
||||
import io.gmss.infocad.entities.infocad.parametre.NatureDomaine;
|
||||
import io.gmss.infocad.interfaces.infocad.parametre.NatureDomaineService;
|
||||
import io.gmss.infocad.paylaods.ApiResponse;
|
||||
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 javax.validation.Valid;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/nature-domaine", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public class NatureDomaineController {
|
||||
|
||||
private final NatureDomaineService natureDomaineService;
|
||||
|
||||
public NatureDomaineController(NatureDomaineService natureDomaineService) {
|
||||
this.natureDomaineService = natureDomaineService;
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createNatureDomaine(@RequestBody @Valid @Validated NatureDomaine natureDomaine) {
|
||||
try{
|
||||
natureDomaine = natureDomaineService.createNatureDomaine(natureDomaine);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, natureDomaine, "Nature Domaine créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
public ResponseEntity<?> updateNatureDomaine(@PathVariable Long id, @RequestBody NatureDomaine natureDomaine) {
|
||||
try{
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, natureDomaineService.updateNatureDomaine(id, natureDomaine), "Nature Domaine mise à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ResponseEntity<?> deleteNatureDomainer(@PathVariable Long id) {
|
||||
try{
|
||||
natureDomaineService.deleteNatureDomaine(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,"Nature Domaine supprimée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<?> getAllNatureDomaineList() {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, natureDomaineService.getNatureDomaineList(), "Liste des natures de domaine chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/all-paged")
|
||||
public ResponseEntity<?> getAllNatureDomainePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, natureDomaineService.getNatureDomaineList(pageable), "Liste des natures de domaine chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/id/{id}")
|
||||
public ResponseEntity<?> getNatureDomaineById(@PathVariable Long id) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, natureDomaineService.getNatureDomaineById(id), "Nature Domaine trouvé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package io.gmss.infocad.controllers.infocad.parametre;
|
||||
|
||||
|
||||
import io.gmss.infocad.entities.infocad.parametre.PositionRepresentation;
|
||||
import io.gmss.infocad.interfaces.infocad.parametre.PositionRepresentationService;
|
||||
import io.gmss.infocad.paylaods.ApiResponse;
|
||||
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 javax.validation.Valid;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/position-representation", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public class PositionRepresentationController {
|
||||
|
||||
private final PositionRepresentationService positionRepresentationService;
|
||||
|
||||
public PositionRepresentationController(PositionRepresentationService positionRepresentationService) {
|
||||
this.positionRepresentationService = positionRepresentationService;
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createPositionRepresentation(@RequestBody @Valid @Validated PositionRepresentation positionRepresentation) {
|
||||
try{
|
||||
positionRepresentation = positionRepresentationService.createPositionRepresentation(positionRepresentation);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, positionRepresentation, "Position de representation créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
public ResponseEntity<?> updatePositionRepresentation(@PathVariable Long id, @RequestBody PositionRepresentation positionRepresentation) {
|
||||
try{
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, positionRepresentationService.updatePositionRepresentation(id, positionRepresentation), "Position de representation mise à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ResponseEntity<?> deletePositionRepresentation(@PathVariable Long id) {
|
||||
try{
|
||||
positionRepresentationService.deletePositionRepresentation(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,"Position de representation supprimée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<?> getAllPositionRepresentationList() {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, positionRepresentationService.getPositionRepresentationList(), "Liste des positions de representation chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/all-paged")
|
||||
public ResponseEntity<?> getAllPositionRepresentationPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, positionRepresentationService.getPositionRepresentationList(pageable), "Liste des positions de representation chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/id/{id}")
|
||||
public ResponseEntity<?> getPositionRepresentationById(@PathVariable Long id) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, positionRepresentationService.getPositionRepresentationById(id), "Position de representation trouvée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package io.gmss.infocad.controllers.infocad.parametre;
|
||||
|
||||
|
||||
import io.gmss.infocad.entities.infocad.parametre.Profession;
|
||||
import io.gmss.infocad.interfaces.infocad.parametre.ProfessionService;
|
||||
import io.gmss.infocad.paylaods.ApiResponse;
|
||||
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 javax.validation.Valid;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/profession", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public class ProfessionController {
|
||||
|
||||
private final ProfessionService professionService;
|
||||
|
||||
public ProfessionController(ProfessionService professionService) {
|
||||
this.professionService = professionService;
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createProfession(@RequestBody @Valid @Validated Profession profession) {
|
||||
try{
|
||||
profession = professionService.createProfession(profession);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, profession, "Profession créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
public ResponseEntity<?> updateProfession(@PathVariable Long id, @RequestBody Profession profession) {
|
||||
try{
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, professionService.updateProfession(id, profession), "Profession mise à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ResponseEntity<?> deleteProfessionr(@PathVariable Long id) {
|
||||
try{
|
||||
professionService.deleteProfession(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,"Profession supprimée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<?> getAllProfessionList() {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, professionService.getProfessionList(), "Liste des professions chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/all-paged")
|
||||
public ResponseEntity<?> getAllProfessionPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, professionService.getProfessionList(pageable), "Liste des professions chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/id/{id}")
|
||||
public ResponseEntity<?> getProfessionById(@PathVariable Long id) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, professionService.getProfessionById(id), "Profession trouvée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package io.gmss.infocad.controllers.infocad.parametre;
|
||||
|
||||
|
||||
import io.gmss.infocad.entities.infocad.parametre.SituationGeographique;
|
||||
import io.gmss.infocad.interfaces.infocad.parametre.SituationGeographiqueService;
|
||||
import io.gmss.infocad.paylaods.ApiResponse;
|
||||
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 javax.validation.Valid;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/situation-geographique", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public class SituationGeographiqueController {
|
||||
|
||||
private final SituationGeographiqueService situationGeographiqueService;
|
||||
|
||||
public SituationGeographiqueController(SituationGeographiqueService situationGeographiqueService) {
|
||||
this.situationGeographiqueService = situationGeographiqueService;
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createSituationGeographique(@RequestBody @Valid @Validated SituationGeographique situationGeographique) {
|
||||
try{
|
||||
situationGeographique = situationGeographiqueService.createSituationGeographique(situationGeographique);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, situationGeographique, "Situation géographique créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
public ResponseEntity<?> updateSituationGeographique(@PathVariable Long id, @RequestBody SituationGeographique situationGeographique) {
|
||||
try{
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, situationGeographiqueService.updateSituationGeographique(id, situationGeographique), "Situation géographique mis à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ResponseEntity<?> deleteSituationGeographiquer(@PathVariable Long id) {
|
||||
try{
|
||||
situationGeographiqueService.deleteSituationGeographique(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,"Situation géographique supprimée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<?> getAllSituationGeographiqueList() {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, situationGeographiqueService.getSituationGeographiqueList(), "Liste des situations géographiques chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/all-paged")
|
||||
public ResponseEntity<?> getAllSituationGeographiquePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, situationGeographiqueService.getSituationGeographiqueList(pageable), "Liste des situations géographiques chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/id/{id}")
|
||||
public ResponseEntity<?> getSituationGeographiqueById(@PathVariable Long id) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, situationGeographiqueService.getSituationGeographiqueById(id), "Situation géographique trouvée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package io.gmss.infocad.controllers.infocad.parametre;
|
||||
|
||||
|
||||
import io.gmss.infocad.entities.infocad.parametre.SituationMatrimoniale;
|
||||
import io.gmss.infocad.interfaces.infocad.parametre.SituationMatrimonialeService;
|
||||
import io.gmss.infocad.paylaods.ApiResponse;
|
||||
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 javax.validation.Valid;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/situation-matrimoniale", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public class SituationMatrimonialeController {
|
||||
|
||||
private final SituationMatrimonialeService situationMatrimonialeService;
|
||||
|
||||
public SituationMatrimonialeController(SituationMatrimonialeService situationMatrimonialeService) {
|
||||
this.situationMatrimonialeService = situationMatrimonialeService;
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createSituationMatrimoniale(@RequestBody @Valid @Validated SituationMatrimoniale situationMatrimoniale) {
|
||||
try{
|
||||
situationMatrimoniale = situationMatrimonialeService.createSituationMatrimoniale(situationMatrimoniale);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, situationMatrimoniale, "Situation matrimoniale créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
public ResponseEntity<?> updateSituationMatrimoniale(@PathVariable Long id, @RequestBody SituationMatrimoniale situationMatrimoniale) {
|
||||
try{
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, situationMatrimonialeService.updateSituationMatrimoniale(id, situationMatrimoniale), "Situation matrimoniale mise à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ResponseEntity<?> deleteSituationMatrimonialer(@PathVariable Long id) {
|
||||
try{
|
||||
situationMatrimonialeService.deleteSituationMatrimoniale(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,"Situation matrimoniale supprimé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<?> getAllSituationMatrimonialeList() {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, situationMatrimonialeService.getSituationMatrimonialeList(), "Liste des situations matrimoniales chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/all-paged")
|
||||
public ResponseEntity<?> getAllSituationMatrimonialePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, situationMatrimonialeService.getSituationMatrimonialeList(pageable), "Liste des situations matrimoniales chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/id/{id}")
|
||||
public ResponseEntity<?> getSituationMatrimonialeById(@PathVariable Long id) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, situationMatrimonialeService.getSituationMatrimonialeById(id), "Situation matrimoniale trouvé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package io.gmss.infocad.controllers.infocad.parametre;
|
||||
|
||||
|
||||
import io.gmss.infocad.entities.infocad.parametre.SourceDroit;
|
||||
import io.gmss.infocad.interfaces.infocad.parametre.SourceDroitService;
|
||||
import io.gmss.infocad.paylaods.ApiResponse;
|
||||
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 javax.validation.Valid;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/source-droit", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public class SourceDroitController {
|
||||
|
||||
private final SourceDroitService sourceDroitService;
|
||||
|
||||
public SourceDroitController(SourceDroitService sourceDroitService) {
|
||||
this.sourceDroitService = sourceDroitService;
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createSourceDroit(@RequestBody @Valid @Validated SourceDroit sourceDroit) {
|
||||
try{
|
||||
sourceDroit = sourceDroitService.createSourceDroit(sourceDroit);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, sourceDroit, "Source de droit créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
public ResponseEntity<?> updateSourceDroit(@PathVariable Long id, @RequestBody SourceDroit sourceDroit) {
|
||||
try{
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, sourceDroitService.updateSourceDroit(id, sourceDroit), "Source de droit mise à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ResponseEntity<?> deleteSourceDroitr(@PathVariable Long id) {
|
||||
try{
|
||||
sourceDroitService.deleteSourceDroit(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,"Source de droit supprimée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<?> getAllSourceDroitList() {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, sourceDroitService.getSourceDroitList(), "Liste des sources de droit chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/all-paged")
|
||||
public ResponseEntity<?> getAllSourceDroitPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, sourceDroitService.getSourceDroitList(pageable), "Liste des sources de droit chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/id/{id}")
|
||||
public ResponseEntity<?> getSourceDroitById(@PathVariable Long id) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, sourceDroitService.getSourceDroitById(id), "Source de droit trouvé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package io.gmss.infocad.controllers.infocad.parametre;
|
||||
|
||||
|
||||
import io.gmss.infocad.entities.infocad.parametre.Structure;
|
||||
import io.gmss.infocad.interfaces.decoupage.ArrondissementService;
|
||||
import io.gmss.infocad.interfaces.infocad.parametre.StructureService;
|
||||
import io.gmss.infocad.paylaods.ApiResponse;
|
||||
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 javax.validation.Valid;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/structure", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public class StructureController {
|
||||
|
||||
private final StructureService structureService;
|
||||
private final ArrondissementService arrondissementService;
|
||||
|
||||
public StructureController(StructureService structureService, ArrondissementService arrondissementService) {
|
||||
this.structureService = structureService;
|
||||
this.arrondissementService = arrondissementService;
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createStructure(@RequestBody @Valid @Validated Structure structure) {
|
||||
try{
|
||||
structure = structureService.createStructure(structure);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, structure, "Structure créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
public ResponseEntity<?> updateStructure(@PathVariable Long id, @RequestBody Structure structure) {
|
||||
try{
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, structureService.updateStructure(id, structure), "Structure mise à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ResponseEntity<?> deleteStructurer(@PathVariable Long id) {
|
||||
try{
|
||||
structureService.deleteStructure(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,"Structure supprimée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<?> getAllStructureList() {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, structureService.getStructureList(), "Liste des structures chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/all-by-arrondissement")
|
||||
public ResponseEntity<?> getAllStructureListByArrondissement(@RequestParam Long arrondissementId) {
|
||||
|
||||
if(arrondissementService.getArrondissementById(arrondissementId).isPresent()){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, structureService.getStructuresByArrondissement(arrondissementId), "Liste des structures chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}else{
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false,"Impossible de trouver l'arrondissement spécifiée."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all-paged")
|
||||
public ResponseEntity<?> getAllStructurePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, structureService.getStructureList(pageable), "Liste des structures chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/id/{id}")
|
||||
public ResponseEntity<?> getStructureById(@PathVariable Long id) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, structureService.getStructureById(id), "Structure trouvé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package io.gmss.infocad.controllers.infocad.parametre;
|
||||
|
||||
|
||||
import io.gmss.infocad.entities.infocad.parametre.TypeContestation;
|
||||
import io.gmss.infocad.interfaces.infocad.parametre.TypeContestationService;
|
||||
import io.gmss.infocad.paylaods.ApiResponse;
|
||||
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 javax.validation.Valid;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/type-contestation", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public class TypeContestationController {
|
||||
|
||||
private final TypeContestationService typeContestationService;
|
||||
|
||||
public TypeContestationController(TypeContestationService typeContestationService) {
|
||||
this.typeContestationService = typeContestationService;
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createTypeContestation(@RequestBody @Valid @Validated TypeContestation typeContestation) {
|
||||
try{
|
||||
typeContestation = typeContestationService.createTypeContestation(typeContestation);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, typeContestation, "Type de contestation créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
public ResponseEntity<?> updateTypeContestation(@PathVariable Long id, @RequestBody TypeContestation typeContestation) {
|
||||
try{
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, typeContestationService.updateTypeContestation(id, typeContestation), "Type de contestation mis à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ResponseEntity<?> deleteTypeContestationr(@PathVariable Long id) {
|
||||
try{
|
||||
typeContestationService.deleteTypeContestation(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,"Type de contestation supprimé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<?> getAllTypeContestationList() {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, typeContestationService.getTypeContestationList(), "Liste des types de contestation chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/all-paged")
|
||||
public ResponseEntity<?> getAllTypeContestationPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, typeContestationService.getTypeContestationList(pageable), "Liste des types de contestation chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/id/{id}")
|
||||
public ResponseEntity<?> getTypeContestationById(@PathVariable Long id) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, typeContestationService.getTypeContestationById(id), "Type de contestation trouvé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package io.gmss.infocad.controllers.infocad.parametre;
|
||||
|
||||
|
||||
import io.gmss.infocad.entities.infocad.parametre.TypeDomaine;
|
||||
import io.gmss.infocad.interfaces.infocad.parametre.TypeDomaineService;
|
||||
import io.gmss.infocad.paylaods.ApiResponse;
|
||||
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 javax.validation.Valid;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/type-domaine", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public class TypeDomaineController {
|
||||
|
||||
private final TypeDomaineService typeDomaineService;
|
||||
|
||||
public TypeDomaineController(TypeDomaineService typeDomaineService) {
|
||||
this.typeDomaineService = typeDomaineService;
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createTypeDomaine(@RequestBody @Valid @Validated TypeDomaine typeDomaine) {
|
||||
try{
|
||||
typeDomaine = typeDomaineService.createTypeDomaine(typeDomaine);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, typeDomaine, "Type de domaine créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
public ResponseEntity<?> updateTypeDomaine(@PathVariable Long id, @RequestBody TypeDomaine typeDomaine) {
|
||||
try{
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, typeDomaineService.updateTypeDomaine(id, typeDomaine), "Type de domaine mis à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ResponseEntity<?> deleteTypeDomainer(@PathVariable Long id) {
|
||||
try{
|
||||
typeDomaineService.deleteTypeDomaine(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,"Type de domaine supprimé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<?> getAllTypeDomaineList() {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, typeDomaineService.getTypeDomaineList(), "Liste des types de domaine chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/all-paged")
|
||||
public ResponseEntity<?> getAllTypeDomainePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, typeDomaineService.getTypeDomaineList(pageable), "Liste des types de domaine chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/id/{id}")
|
||||
public ResponseEntity<?> getTypeDomaineById(@PathVariable Long id) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, typeDomaineService.getTypeDomaineById(id), "Type de domaine trouvé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package io.gmss.infocad.controllers.infocad.parametre;
|
||||
|
||||
|
||||
import io.gmss.infocad.entities.infocad.parametre.TypePersonne;
|
||||
import io.gmss.infocad.interfaces.infocad.parametre.TypePersonneService;
|
||||
import io.gmss.infocad.paylaods.ApiResponse;
|
||||
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 javax.validation.Valid;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/type-personne", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public class TypePersonneController {
|
||||
|
||||
private final TypePersonneService typePersonneService;
|
||||
|
||||
public TypePersonneController(TypePersonneService typePersonneService) {
|
||||
this.typePersonneService = typePersonneService;
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createTypePersonne(@RequestBody @Valid @Validated TypePersonne typePersonne) {
|
||||
try{
|
||||
typePersonne = typePersonneService.createTypePersonne(typePersonne);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, typePersonne, "Type de personne créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
public ResponseEntity<?> updateTypePersonne(@PathVariable Long id, @RequestBody TypePersonne typePersonne) {
|
||||
try{
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, typePersonneService.updateTypePersonne(id, typePersonne), "Type de personne mis à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ResponseEntity<?> deleteTypePersonner(@PathVariable Long id) {
|
||||
try{
|
||||
typePersonneService.deleteTypePersonne(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,"Type de personne supprimé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<?> getAllTypePersonneList() {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, typePersonneService.getTypePersonneList(), "Liste des types de personne chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/all-paged")
|
||||
public ResponseEntity<?> getAllTypePersonnePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, typePersonneService.getTypePersonneList(pageable), "Liste des types de personne chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/id/{id}")
|
||||
public ResponseEntity<?> getTypePersonneById(@PathVariable Long id) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, typePersonneService.getTypePersonneById(id), "Type de personne trouvé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package io.gmss.infocad.controllers.infocad.parametre;
|
||||
|
||||
|
||||
import io.gmss.infocad.entities.infocad.parametre.TypePiece;
|
||||
import io.gmss.infocad.interfaces.infocad.parametre.TypePieceService;
|
||||
import io.gmss.infocad.paylaods.ApiResponse;
|
||||
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 javax.validation.Valid;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/type-piece", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public class TypePieceController {
|
||||
|
||||
private final TypePieceService typePieceService;
|
||||
|
||||
public TypePieceController(TypePieceService typePieceService) {
|
||||
this.typePieceService = typePieceService;
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createTypePiece(@RequestBody @Valid @Validated TypePiece typePiece) {
|
||||
try{
|
||||
typePiece = typePieceService.createTypePiece(typePiece);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, typePiece, "Type de piece créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
public ResponseEntity<?> updateTypePiece(@PathVariable Long id, @RequestBody TypePiece typePiece) {
|
||||
try{
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, typePieceService.updateTypePiece(id, typePiece), "Type de piece mis à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ResponseEntity<?> deleteTypePiecer(@PathVariable Long id) {
|
||||
try{
|
||||
typePieceService.deleteTypePiece(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,"Type de piece supprimé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<?> getAllTypePieceList() {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, typePieceService.getTypePieceList(), "Liste des types de piece chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/all-paged")
|
||||
public ResponseEntity<?> getAllTypePiecePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, typePieceService.getTypePieceList(pageable), "Liste des types de piece chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/id/{id}")
|
||||
public ResponseEntity<?> getTypePieceById(@PathVariable Long id) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, typePieceService.getTypePieceById(id), "Type de piece trouvé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package io.gmss.infocad.controllers.infocad.parametre;
|
||||
|
||||
|
||||
import io.gmss.infocad.entities.infocad.parametre.TypeRepresentation;
|
||||
import io.gmss.infocad.interfaces.infocad.parametre.TypeRepresentationService;
|
||||
import io.gmss.infocad.paylaods.ApiResponse;
|
||||
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 javax.validation.Valid;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/type-representation", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public class TypeRepresentationController {
|
||||
|
||||
private final TypeRepresentationService typeRepresentationService;
|
||||
|
||||
public TypeRepresentationController(TypeRepresentationService typeRepresentationService) {
|
||||
this.typeRepresentationService = typeRepresentationService;
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createTypeRepresentation(@RequestBody @Valid @Validated TypeRepresentation typeRepresentation) {
|
||||
try{
|
||||
typeRepresentation = typeRepresentationService.createTypeRepresentation(typeRepresentation);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, typeRepresentation, "Type de representation créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
public ResponseEntity<?> updateTypeRepresentation(@PathVariable Long id, @RequestBody TypeRepresentation typeRepresentation) {
|
||||
try{
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, typeRepresentationService.updateTypeRepresentation(id, typeRepresentation), "Type de representation mis à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ResponseEntity<?> deleteTypeRepresentationr(@PathVariable Long id) {
|
||||
try{
|
||||
typeRepresentationService.deleteTypeRepresentation(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,"Type de representation supprimé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<?> getAllTypeRepresentationList() {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, typeRepresentationService.getTypeRepresentationList(), "Liste des types de representation chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/all-paged")
|
||||
public ResponseEntity<?> getAllTypeRepresentationPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, typeRepresentationService.getTypeRepresentationList(pageable), "Liste des types de representation chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/id/{id}")
|
||||
public ResponseEntity<?> getTypeRepresentationById(@PathVariable Long id) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, typeRepresentationService.getTypeRepresentationById(id), "Type de representation trouvé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package io.gmss.infocad.controllers.notification;
|
||||
|
||||
import io.gmss.infocad.interfaces.notification.EmailService;
|
||||
import io.gmss.infocad.paylaods.EmailDetails;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/email", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public class EmailController {
|
||||
|
||||
private final EmailService emailService;
|
||||
|
||||
public EmailController(EmailService emailService) {
|
||||
this.emailService = emailService;
|
||||
}
|
||||
|
||||
// Sending a simple Email
|
||||
@PostMapping("/sendMail")
|
||||
public String sendMail(@RequestBody EmailDetails details)
|
||||
{
|
||||
return emailService.sendSimpleMail(details);
|
||||
}
|
||||
|
||||
// Sending email with attachment
|
||||
@PostMapping("/sendMailWithAttachment")
|
||||
public String sendMailWithAttachment(
|
||||
@RequestBody EmailDetails details)
|
||||
{
|
||||
String status
|
||||
= emailService.sendMailWithAttachment(details);
|
||||
|
||||
return status;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package io.gmss.infocad.controllers.report;
|
||||
|
||||
import io.gmss.infocad.enums.FormatRapport;
|
||||
import io.gmss.infocad.paylaods.request.FiltreEnquetePayLoad;
|
||||
import io.gmss.infocad.repositories.infocad.metier.BlocRepository;
|
||||
import io.gmss.infocad.repositories.infocad.parametre.StructureRepository;
|
||||
import io.gmss.infocad.service.ReportService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @author AKAKPO Aurince
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(value = "/api/rapport", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Api(value = "controleur rapport", description = "API d'edition des rapport.", tags = {"Rapports"})
|
||||
@CrossOrigin(origins = "*", maxAge = 3600)
|
||||
public class ReportingController {
|
||||
private final ReportService reportService;
|
||||
private final BlocRepository blocRepository;
|
||||
private final StructureRepository structureRepository;
|
||||
private static final Logger logger = LoggerFactory.getLogger(ReportingController.class);
|
||||
|
||||
public ReportingController(ReportService reportService, BlocRepository blocRepository, StructureRepository structureRepository) {
|
||||
this.reportService = reportService;
|
||||
this.blocRepository = blocRepository;
|
||||
this.structureRepository = structureRepository;
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/structure/blocs/{formatRapport}/{structureId}")
|
||||
@ApiOperation(value = "Liste des blos d'une structure.")
|
||||
public void imprimerBlocsParStructure(HttpServletResponse response, @PathVariable FormatRapport formatRapport, @PathVariable Long structureId) {
|
||||
try {
|
||||
reportService.imprimerBlocsStructure(response,formatRapport,structureId);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/bloc/enquetes/{formatRapport}/{blocId}")
|
||||
@ApiOperation(value = "Liste des zones ou quartiers d'intervention d'une structure.")
|
||||
public void imprimerEnqueteParBloc(HttpServletResponse response, @PathVariable FormatRapport formatRapport, @PathVariable Long blocId) {
|
||||
try {
|
||||
reportService.imprimerEnqueteParBloc(response,formatRapport,blocId);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/filtre/enquetes/{formatRapport}")
|
||||
@ApiOperation(value = "Liste des zones ou quartiers d'intervention d'une structure.")
|
||||
public void imprimerEnqueteParFiltre(HttpServletResponse response, @RequestBody FiltreEnquetePayLoad filtreEnquetePayLoad, @PathVariable FormatRapport formatRapport) {
|
||||
try {
|
||||
reportService.imprimerEnqueteParFiltre(response,filtreEnquetePayLoad,formatRapport);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package io.gmss.infocad.controllers.rfu.parametre;
|
||||
|
||||
|
||||
import io.gmss.infocad.entities.rfu.parametre.Caracteristique;
|
||||
import io.gmss.infocad.interfaces.rfu.parametre.CaracteristiqueService;
|
||||
import io.gmss.infocad.paylaods.ApiResponse;
|
||||
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 javax.validation.Valid;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/caracteristique", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public class CaracteristiqueController {
|
||||
|
||||
private final CaracteristiqueService caracteristiqueService;
|
||||
|
||||
public CaracteristiqueController(CaracteristiqueService caracteristiqueService) {
|
||||
this.caracteristiqueService = caracteristiqueService;
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createCaracteristique(@RequestBody @Valid @Validated Caracteristique caracteristique) {
|
||||
try{
|
||||
caracteristique = caracteristiqueService.createCaracteristique(caracteristique);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, caracteristique, "Caracteristique créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
public ResponseEntity<?> updateCaracteristique(@PathVariable Long id, @RequestBody Caracteristique caracteristique) {
|
||||
try{
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, caracteristiqueService.updateCaracteristique(id, caracteristique), "Caracteristique mise à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ResponseEntity<?> deleteCaracteristique(@PathVariable Long id) {
|
||||
try{
|
||||
caracteristiqueService.deleteCaracteristique(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,"Caracteristique supprimée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<?> getAllCaracteristiqueList() {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, caracteristiqueService.getCaracteristiqueList(), "Liste des caractéristiques chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/all-paged")
|
||||
public ResponseEntity<?> getAllCaracteristiquePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, caracteristiqueService.getCaracteristiqueList(pageable), "Liste des caractéristiques chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/id/{id}")
|
||||
public ResponseEntity<?> getCaracteristiqueById(@PathVariable Long id) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, caracteristiqueService.getCaracteristiqueById(id), "Caracteristique trouvée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package io.gmss.infocad.controllers.rfu.parametre;
|
||||
|
||||
|
||||
import io.gmss.infocad.entities.rfu.parametre.TypeCaracteristique;
|
||||
import io.gmss.infocad.interfaces.rfu.parametre.TypeCaracteristiqueService;
|
||||
import io.gmss.infocad.paylaods.ApiResponse;
|
||||
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 javax.validation.Valid;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/type-caracteristique", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public class TypeCaracteristiqueController {
|
||||
|
||||
private final TypeCaracteristiqueService typeCaracteristiqueService;
|
||||
|
||||
public TypeCaracteristiqueController(TypeCaracteristiqueService typeCaracteristiqueService) {
|
||||
this.typeCaracteristiqueService = typeCaracteristiqueService;
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createTypeCaracteristique(@RequestBody @Valid @Validated TypeCaracteristique typeCaracteristique) {
|
||||
try{
|
||||
typeCaracteristique = typeCaracteristiqueService.createTypeCaracteristique(typeCaracteristique);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, typeCaracteristique, "Type de caracteristique créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
public ResponseEntity<?> updateTypeCaracteristique(@PathVariable Long id, @RequestBody TypeCaracteristique typeCaracteristique) {
|
||||
try{
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, typeCaracteristiqueService.updateTypeCaracteristique(id, typeCaracteristique), "Type caracteristique mis à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ResponseEntity<?> deleteTypeCaracteristique(@PathVariable Long id) {
|
||||
try{
|
||||
typeCaracteristiqueService.deleteTypeCaracteristique(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,"Type caracteristique supprimé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<?> getAllTypeCaracteristiqueList() {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, typeCaracteristiqueService.getTypeCaracteristiqueList(), "Liste des types caracteristiques chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/all-paged")
|
||||
public ResponseEntity<?> getAllTypeCaracteristiquePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, typeCaracteristiqueService.getTypeCaracteristiqueList(pageable), "Liste des types caracteristiques chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/id/{id}")
|
||||
public ResponseEntity<?> getTypeCaracteristiqueById(@PathVariable Long id) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, typeCaracteristiqueService.getTypeCaracteristiqueById(id), "Type caracteristique trouvé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package io.gmss.infocad.controllers.statistique;
|
||||
|
||||
import io.gmss.infocad.interfaces.statistique.StatistiquesService;
|
||||
import io.gmss.infocad.paylaods.ApiResponse;
|
||||
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/statistique", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public class StatistiqueController {
|
||||
private final StatistiquesService statistiquesService ;
|
||||
|
||||
public StatistiqueController(StatistiquesService statistiquesService) {
|
||||
this.statistiquesService = statistiquesService;
|
||||
}
|
||||
@GetMapping(path = "/user/enquete-par-statut")
|
||||
public ResponseEntity<?> getStatistiquesParStatut() {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, statistiquesService.getStatEnqueteParStatut(), "Statistique des enquêtes par statut."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping(path = "/enquete-par-arrondissement/{commune_id}")
|
||||
public ResponseEntity<?> getStatistiquesParArrondissement(@PathVariable Long commune_id) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, statistiquesService.getStatEnqueteAdminDecoupage(commune_id), "Statistique des enquêtes par arrondissement."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping(path = "/user/enquete-par-structure")
|
||||
public ResponseEntity<?> getStatistiquesParStructure() {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, statistiquesService.getStatEnqueteAdminStructure(), "Statistique des enquêtes par structure."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping(path = "/user/enquete-par-bloc")
|
||||
public ResponseEntity<?> getStatistiquesParBloc() {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, statistiquesService.getStatBloc(), "Statistique des enquêtes par bloc."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package io.gmss.infocad.controllers.synchronisation;
|
||||
|
||||
import io.gmss.infocad.interfaces.synchronisation.RestaurationService;
|
||||
import io.gmss.infocad.paylaods.ApiResponse;
|
||||
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/restauration", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public class RestaurationController {
|
||||
public final RestaurationService restaurationService;
|
||||
|
||||
public RestaurationController(RestaurationService restaurationService) {
|
||||
this.restaurationService = restaurationService;
|
||||
}
|
||||
|
||||
@GetMapping(path = "/enquete/{terminalId}")
|
||||
public ResponseEntity<?> getEnquetes(@PathVariable Long terminalId) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, restaurationService.getEnquete(terminalId), "liste des enquetes avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping(path = "/acteur-concerne/{terminalId}")
|
||||
public ResponseEntity<?> getActeurConcerne(@PathVariable Long terminalId) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, restaurationService.getActeurConcernes(terminalId), "liste des acteurs concernés avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping(path = "/personne/{terminalId}") // ok
|
||||
public ResponseEntity<?> getPersonnes(@PathVariable Long terminalId) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, restaurationService.getPersonne(terminalId), "liste des personnes avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping(path = "/membre-groupe/{terminalId}")
|
||||
public ResponseEntity<?> getMembrePersonnes(@PathVariable Long terminalId) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, restaurationService.getMembreGroupe(terminalId), "liste des membres groupe avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping(path = "/parcelle/{terminalId}")
|
||||
public ResponseEntity<?> getParcelle(@PathVariable Long terminalId) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, restaurationService.getParcelle(terminalId), "liste des parcelle avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping(path = "/piece/{terminalId}")
|
||||
public ResponseEntity<?> getPieces(@PathVariable Long terminalId) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, restaurationService.getPieces(terminalId), "liste des enquetes avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping(path = "/upload/{terminalId}")
|
||||
public ResponseEntity<?> getUpload(@PathVariable Long terminalId) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, restaurationService.getUpload(terminalId), "liste des enquetes avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping(path = "/current-user-tpes")
|
||||
public ResponseEntity<?> getCurrentUserTpe() {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, restaurationService.getTpeListByCurrentUser(), "liste des enquetes avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
package io.gmss.infocad.controllers.synchronisation;
|
||||
|
||||
import io.gmss.infocad.interfaces.synchronisation.SynchronisationService;
|
||||
import io.gmss.infocad.paylaods.ApiResponse;
|
||||
import io.gmss.infocad.paylaods.request.*;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/synchronisation", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public class SynchronisationController {
|
||||
private final SynchronisationService synchronisationService;
|
||||
|
||||
public SynchronisationController(SynchronisationService synchronisationService) {
|
||||
this.synchronisationService = synchronisationService;
|
||||
}
|
||||
|
||||
@GetMapping("/user-decoupage-territorial")
|
||||
public ResponseEntity<?> getUserDecoupageTerritorial() {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, synchronisationService.getDecoupageAdminUserConnecter(), "Liste des découpages territoriaux chargés avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/references")
|
||||
public ResponseEntity<?> getAllReferences() {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, synchronisationService.getReferencesSyncResponses(), "Liste des données de référence chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@PostMapping("/personnes")
|
||||
public ResponseEntity<?> syncPersonne(@RequestBody List<PersonnePayLoad> personnePayLoads) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, synchronisationService.syncPersonnes(personnePayLoads), "Liste des personnes synchronisée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
@PostMapping("/membre-groupe")
|
||||
public ResponseEntity<?> syncMembreGroupe(@RequestBody List<MembreGroupePayLoad> membreGroupePayLoads) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, synchronisationService.syncMembreGroupe(membreGroupePayLoads), "Liste des membres de groupes de personnes synchronisée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
@PostMapping("/enquete")
|
||||
public ResponseEntity<?> syncEnquete(@RequestBody List<EnquetePayLoad> enquetePayLoads) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, synchronisationService.syncEnquete(enquetePayLoads), "Liste des enquêtes synchronisée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
@PostMapping("/parcelle")
|
||||
public ResponseEntity<?> syncParcelle(@RequestBody List<ParcellePayLoad> parcellePayLoads) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, synchronisationService.syncParcelle(parcellePayLoads), "Liste des parceclles synchronisée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
@PostMapping("/piece")
|
||||
public ResponseEntity<?> syncPiece(@RequestBody List<PiecePayLoad> piecePayLoads) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, synchronisationService.syncPiece(piecePayLoads), "Liste des pièces synchronisée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
@PostMapping("/acteur-concerne")
|
||||
public ResponseEntity<?> syncActeurConcerne(@RequestBody List<ActeurConcernePayLoad> piecePayLoads) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, synchronisationService.syncActeurConcerne(piecePayLoads), "Liste des acteurs concernes synchronisée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
//@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
|
||||
) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, synchronisationService.syncFiles(file,
|
||||
idBackend,
|
||||
externalKey,
|
||||
pieceId,
|
||||
membreGroupeId,
|
||||
terminalId,
|
||||
name,
|
||||
filePath,
|
||||
max_numero_piece_id,
|
||||
max_numero_upload_id,
|
||||
max_numero_acteur_concerne_id,
|
||||
enqueteId), "Liste des fichiers synchronisée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@PostMapping(path = "/synchronise/all-enquete-data")
|
||||
public ResponseEntity<?> syncAllEnqueteData(@ModelAttribute EnqueteAllDataPayload enqueteAllDataPayload) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, synchronisationService.syncEnqueteAllData(enqueteAllDataPayload), "Les enquetes sont synchronisées avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@PostMapping(path = "/synchronise/enquete/confirme-from-mobile")
|
||||
public ResponseEntity<?> syncAllEnqueteData(@RequestBody List<Long> idEnquetes) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, synchronisationService.syncEnqueteFromMobile(idEnquetes), "Synchronisation confirmée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
106
src/main/java/io/gmss/infocad/controllers/user/AuthController.java
Executable file
106
src/main/java/io/gmss/infocad/controllers/user/AuthController.java
Executable file
@@ -0,0 +1,106 @@
|
||||
package io.gmss.infocad.controllers.user;
|
||||
|
||||
import io.gmss.infocad.entities.user.Role;
|
||||
import io.gmss.infocad.entities.user.User;
|
||||
import io.gmss.infocad.enums.UserRole;
|
||||
import io.gmss.infocad.interfaces.infocad.parametre.StructureService;
|
||||
import io.gmss.infocad.interfaces.user.RoleService;
|
||||
import io.gmss.infocad.interfaces.user.UserService;
|
||||
import io.gmss.infocad.paylaods.ApiResponse;
|
||||
import io.gmss.infocad.paylaods.JwtAuthenticationResponse;
|
||||
import io.gmss.infocad.paylaods.Login;
|
||||
import io.gmss.infocad.paylaods.UserRequest;
|
||||
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.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/auth", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public class AuthController {
|
||||
|
||||
private final UserService userService;
|
||||
private final RoleService roleService;
|
||||
private final StructureService structureService;
|
||||
|
||||
public AuthController(UserService userService, RoleService roleService, StructureService structureService) {
|
||||
this.userService = userService;
|
||||
this.roleService = roleService;
|
||||
this.structureService = structureService;
|
||||
}
|
||||
|
||||
@PostMapping(value = "/login")
|
||||
public ResponseEntity<?> login(@RequestBody @Validated @Valid Login login) {
|
||||
try{
|
||||
JwtAuthenticationResponse jwtAuthenticationResponse = userService.loginUser(login);
|
||||
|
||||
if(!jwtAuthenticationResponse.getToken().isEmpty()){
|
||||
User user = userService.getUserByUsername(login.getUsername());
|
||||
if(user.isResetPassword()){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, jwtAuthenticationResponse, "Vous devez impérativement changer son mot de passe avant de pouvoir continuer toute action dans le logiciel infocad."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}else{
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, jwtAuthenticationResponse, "Authentification réussie avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}else{
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, "Authentification échouée."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<User>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/signup")
|
||||
public ResponseEntity<?> createUser(@RequestBody @Valid @Validated UserRequest userRequest) {
|
||||
try{
|
||||
User user = getUser(userRequest);
|
||||
user.setUsername(userRequest.getEmail());
|
||||
user = userService.createUser(user, false);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, user, "User created successully."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private User getUser(UserRequest userRequest) {
|
||||
User user = new User();
|
||||
user.setNom(userRequest.getNom());
|
||||
user.setPrenom(userRequest.getPrenom());
|
||||
user.setTel(userRequest.getTelephone());
|
||||
user.setEmail(userRequest.getEmail());
|
||||
user.setUsername(userRequest.getEmail());
|
||||
user.setPassword(userRequest.getPassword());
|
||||
user.setActive(false);
|
||||
Set<Role> roleSet = new HashSet<>();
|
||||
roleSet.add(roleService.getRoleByRoleName(UserRole.ROLE_ANONYMOUS).get());
|
||||
user.setRoles(roleSet);
|
||||
user.setStructure(structureService.getStructureById(userRequest.getStructureId()).get());
|
||||
return user;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
package io.gmss.infocad.controllers.user;
|
||||
|
||||
|
||||
import io.gmss.infocad.entities.user.DemandeReinitialisationMP;
|
||||
import io.gmss.infocad.entities.user.User;
|
||||
import io.gmss.infocad.enums.UserRole;
|
||||
import io.gmss.infocad.interfaces.user.DemandeReinitialisationMPService;
|
||||
import io.gmss.infocad.interfaces.user.RoleService;
|
||||
import io.gmss.infocad.interfaces.user.UserService;
|
||||
import io.gmss.infocad.paylaods.ApiResponse;
|
||||
import io.gmss.infocad.paylaods.DemandeReinitialisationMPResponse;
|
||||
import io.gmss.infocad.security.CurrentUser;
|
||||
import io.gmss.infocad.security.UserPrincipal;
|
||||
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.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/demande-reinitialisation-mp", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public class DemandeReinitialisationMPController {
|
||||
|
||||
private final DemandeReinitialisationMPService demandeReinitialisationMPService;
|
||||
private final UserService userService;
|
||||
private final RoleService roleService;
|
||||
|
||||
public DemandeReinitialisationMPController(DemandeReinitialisationMPService demandeReinitialisationMPService, UserService userService, RoleService roleService) {
|
||||
this.demandeReinitialisationMPService = demandeReinitialisationMPService;
|
||||
this.userService = userService;
|
||||
this.roleService = roleService;
|
||||
}
|
||||
|
||||
@GetMapping("/create")
|
||||
public ResponseEntity<?> createDemandeReinitialisationMP(@RequestParam String usernamrOrEmail) {
|
||||
try {
|
||||
demandeReinitialisationMPService.createDemandeReinitialisationMP(usernamrOrEmail);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, "DemandeReinitialisation MP créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (Exception e) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
public ResponseEntity<?> updateDemandeReinitialisationMP(@PathVariable Long id, @RequestBody DemandeReinitialisationMP demandeReinitialisationMP) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, demandeReinitialisationMPService.updateDemandeReinitialisationMP(id, demandeReinitialisationMP), "DemandeReinitialisationMP mis à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (Exception e) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ResponseEntity<?> deleteDemandeReinitialisationMPr(@PathVariable Long id) {
|
||||
try {
|
||||
demandeReinitialisationMPService.deleteDemandeReinitialisationMP(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, "Demande de Reinitialisation de mot de passe supprimé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (Exception e) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<?> getAllDemandeReinitialisationMPList(@CurrentUser UserPrincipal userPrincipal) {
|
||||
try {
|
||||
|
||||
User user = userPrincipal.getUser();
|
||||
|
||||
if(user.getRoles().stream().anyMatch(r -> r.getNom().equals(UserRole.ROLE_ADMIN))){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, demandeReinitialisationMPService.getDemandeReinitialisationMPList(), "Liste des demande de Reinitialisation chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}else{
|
||||
if (user.getStructure() == null) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, "Cet utilisateur n'est pas dans une structure; on ne peut donc pas afficher les demandes de réinitialisation de mot de passe."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} else {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, demandeReinitialisationMPService.getDemandeReinitialisationMPNonTraiteList(user.getStructure()), "Liste des demande de Reinitialisation chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
// }else {
|
||||
// if (user.getStructure() == null) {
|
||||
// return new ResponseEntity<>(
|
||||
// new ApiResponse<>(false, "Cet utilisateur n'est pas dans une structure; on ne peut donc pas afficher les demandes de réinitialisation de mot de passe."),
|
||||
// HttpStatus.OK
|
||||
// );
|
||||
// } else {
|
||||
// return new ResponseEntity<>(
|
||||
// new ApiResponse<>(true, demandeReinitialisationMPService.getDemandeReinitialisationMPNonTraiteList(user.getStructure()), "Liste des demande de Reinitialisation chargée avec succès."),
|
||||
// HttpStatus.OK
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
} catch (Exception e) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/all-paged")
|
||||
public ResponseEntity<?> getAllDemandeReinitialisationMPPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, demandeReinitialisationMPService.getDemandeReinitialisationMPList(pageable), "Liste des demandeReinitialisationMP chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/id/{id}")
|
||||
public ResponseEntity<?> getDemandeReinitialisationMPById(@PathVariable Long id) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, demandeReinitialisationMPService.getDemandeReinitialisationMPById(id), "DemandeReinitialisationMP trouvé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/reset")
|
||||
public ResponseEntity<?> traiterDemande(@RequestParam Long id, @RequestParam String password) {
|
||||
DemandeReinitialisationMP demandeReinitialisationMP = demandeReinitialisationMPService.traiterDemandeReinitialisation(id, password);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,
|
||||
new DemandeReinitialisationMPResponse(
|
||||
userService.getUserResponseFromUser(demandeReinitialisationMP.getUser()),
|
||||
demandeReinitialisationMP.getEtatDemande()
|
||||
),
|
||||
"Traitement effectué avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
93
src/main/java/io/gmss/infocad/controllers/user/RoleController.java
Executable file
93
src/main/java/io/gmss/infocad/controllers/user/RoleController.java
Executable file
@@ -0,0 +1,93 @@
|
||||
package io.gmss.infocad.controllers.user;
|
||||
|
||||
|
||||
import io.gmss.infocad.entities.user.Role;
|
||||
import io.gmss.infocad.interfaces.user.RoleService;
|
||||
import io.gmss.infocad.paylaods.ApiResponse;
|
||||
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 javax.validation.Valid;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/role", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public class RoleController {
|
||||
|
||||
private final RoleService roleService;
|
||||
|
||||
public RoleController(RoleService roleService) {
|
||||
this.roleService = roleService;
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createRole(@RequestBody @Valid @Validated Role role) {
|
||||
try{
|
||||
role = roleService.createRole(role);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, role, "Role created successully."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
public ResponseEntity<?> updateRole(@PathVariable Long id, @RequestBody Role role) {
|
||||
try{
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, roleService.updateRole(id, role), "Role updated successully."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ResponseEntity<?> deleteRole(@PathVariable Long id) {
|
||||
try{
|
||||
roleService.deleteRole(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,"Role deleted successully"),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<?> getAll() {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, roleService.getRoleList(), "Liste des roles."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/all-paged")
|
||||
public ResponseEntity<?> getAllPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, roleService.getRoleList(pageable), "Liste des roles."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
217
src/main/java/io/gmss/infocad/controllers/user/UserController.java
Executable file
217
src/main/java/io/gmss/infocad/controllers/user/UserController.java
Executable file
@@ -0,0 +1,217 @@
|
||||
package io.gmss.infocad.controllers.user;
|
||||
|
||||
|
||||
import io.gmss.infocad.entities.user.User;
|
||||
import io.gmss.infocad.enums.UserRole;
|
||||
import io.gmss.infocad.interfaces.user.UserService;
|
||||
import io.gmss.infocad.paylaods.ApiResponse;
|
||||
import io.gmss.infocad.paylaods.Login;
|
||||
import io.gmss.infocad.security.CurrentUser;
|
||||
import io.gmss.infocad.security.UserPrincipal;
|
||||
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 javax.validation.Valid;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/user", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public class UserController {
|
||||
|
||||
private final UserService userService;
|
||||
|
||||
|
||||
public UserController(UserService userService) {
|
||||
this.userService = userService;
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createUser(@RequestBody @Valid @Validated User user) {
|
||||
try{
|
||||
user.setUsername(user.getEmail());
|
||||
user = userService.createUser(user, true);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, user, "Utilisateur créé avec succès"),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/change-password")
|
||||
public ResponseEntity<?> changeUserPassword(@RequestBody @Valid @Validated Login login) {
|
||||
try{
|
||||
userService.updatePassword(login.getUsername(), login.getPassword());
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, "Votre mot de passe à été modifiée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/reset-password")
|
||||
public ResponseEntity<?> resetUserPassword(@RequestBody @Valid @Validated Login login) {
|
||||
try{
|
||||
User user = userService.resetPassword(login.getUsername(), login.getPassword());
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, user, "Votre mot de passe à été réinitialisée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/validate-user-account")
|
||||
public ResponseEntity<?> validateUserAccount(@RequestBody @Valid @Validated Login login) {
|
||||
try{
|
||||
User user = userService.validateUserAccount(login.getUsername(), login.getUserRole());
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, user, "Cet utilisateur à été activé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
public ResponseEntity<?> updateUser(@PathVariable Long id, @RequestBody User user) {
|
||||
try{
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, userService.updateUser(id, user), "User updated successully."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping ("/activate-or-not")
|
||||
public ResponseEntity<?> acitvateOrNotUser(@RequestParam Long id) {
|
||||
try{
|
||||
|
||||
User user = userService.activateOrNotUser(id);
|
||||
String message = "Utilisateur activé avec succès";
|
||||
if(!user.isActive()) {
|
||||
message = "Utilisateur désactivé avec succès";
|
||||
}
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, user , message),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ResponseEntity<?> deleteUser(@PathVariable Long id) {
|
||||
try{
|
||||
userService.deleteUser(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,"User deleted successully"),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<?> getAll(@CurrentUser UserPrincipal userPrincipal) {
|
||||
|
||||
User user = userPrincipal.getUser();
|
||||
|
||||
if(user.getRoles().stream().anyMatch(r -> r.getNom().equals(UserRole.ROLE_ADMIN))){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, userService.getAllUserListResponse(), "Liste des utilisateurs chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}else{
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, userService.getListUserResponseByStructure(userPrincipal.getUser().getStructure().getId()), "Liste des utilisateurs chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all-by-structure")
|
||||
public ResponseEntity<?> getAllByStructure(@CurrentUser UserPrincipal userPrincipal) {
|
||||
|
||||
if(userPrincipal.getUser().getStructure() != null) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, userService.getListUserByStructure(userPrincipal.getUser().getStructure().getId()), "Liste des utilisateurs chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}else{
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, "Impossible de trouver la structure indiquée."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// @GetMapping("/all-paged")
|
||||
// public ResponseEntity<?> getAllpaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
// Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
// return new ResponseEntity<>(
|
||||
// new ApiResponse<>(true, userService.getUserList(pageable), "Liste des utilisateurs chargée avec succès."),
|
||||
// HttpStatus.OK
|
||||
// );
|
||||
// }
|
||||
|
||||
@GetMapping("/id/{id}")
|
||||
public ResponseEntity<?> getUserById(@PathVariable Long id) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, userService.getUserById(id), "User found."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/username/{username}")
|
||||
public ResponseEntity<?> getUserByUsername(@PathVariable String username) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, userService.getUserByUsername(username), "User found."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/all-by-role/{userrole}")
|
||||
public ResponseEntity<?> getUserByUserRole(@PathVariable UserRole userrole) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, userService.getUserByProfil(userrole), "Users found."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package io.gmss.infocad.deserializer;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.JsonDeserializer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
public class LocalDateDeserializer extends JsonDeserializer<LocalDate> {
|
||||
private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
|
||||
@Override
|
||||
public LocalDate deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
|
||||
return LocalDate.parse(p.getText(), formatter);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package io.gmss.infocad.deserializer;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.JsonDeserializer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
public class LocalDateTimeDeserializer extends JsonDeserializer<LocalDateTime> {
|
||||
private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
@Override
|
||||
public LocalDateTime deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
|
||||
return LocalDateTime.parse(p.getText(), formatter);
|
||||
}
|
||||
}
|
||||
39
src/main/java/io/gmss/infocad/entities/BaseEntity.java
Executable file
39
src/main/java/io/gmss/infocad/entities/BaseEntity.java
Executable file
@@ -0,0 +1,39 @@
|
||||
package io.gmss.infocad.entities;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.data.annotation.CreatedBy;
|
||||
import org.springframework.data.annotation.CreatedDate;
|
||||
import org.springframework.data.annotation.LastModifiedBy;
|
||||
import org.springframework.data.annotation.LastModifiedDate;
|
||||
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||
|
||||
import javax.persistence.EntityListeners;
|
||||
import javax.persistence.MappedSuperclass;
|
||||
import java.io.Serializable;
|
||||
import java.time.Instant;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@MappedSuperclass
|
||||
@EntityListeners(AuditingEntityListener.class)
|
||||
|
||||
public class BaseEntity implements Serializable {
|
||||
|
||||
@CreatedDate
|
||||
@JsonIgnore
|
||||
private Instant createdAt;
|
||||
@LastModifiedDate
|
||||
@JsonIgnore
|
||||
private Instant updatedAt;
|
||||
@CreatedBy
|
||||
@JsonIgnore
|
||||
private Long createdBy;
|
||||
@LastModifiedBy
|
||||
@JsonIgnore
|
||||
private Long updatedBy;
|
||||
@JsonIgnore
|
||||
private boolean deleted;
|
||||
private Long externalKey;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package io.gmss.infocad.entities.decoupage;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import io.gmss.infocad.entities.infocad.metier.Bloc;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Where(clause = " deleted = false")
|
||||
public class Arrondissement extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String code;
|
||||
private String nom;
|
||||
@ManyToOne
|
||||
private Commune commune;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "arrondissement")
|
||||
private List<Quartier> quartiers;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "arrondissement")
|
||||
private List<Bloc> blocs;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package io.gmss.infocad.entities.decoupage;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import io.gmss.infocad.entities.infocad.parametre.Personne;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Where(clause = " deleted = false")
|
||||
public class Commune extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String code;
|
||||
private String nom;
|
||||
@ManyToOne
|
||||
private Departement departement;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "commune")
|
||||
private List<Arrondissement> arrondissements;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "commune")
|
||||
private List<Personne> personnes;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package io.gmss.infocad.entities.decoupage;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Where(clause = " deleted = false")
|
||||
public class Departement extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String code;
|
||||
private String nom;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "departement")
|
||||
private List<Commune> communes;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package io.gmss.infocad.entities.decoupage;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import io.gmss.infocad.entities.infocad.parametre.Personne;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SQLDelete(sql =
|
||||
"UPDATE nationalite " +
|
||||
"SET deleted = true " +
|
||||
"WHERE id = ?")
|
||||
@Where(clause = " deleted = false")
|
||||
public class Nationalite extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String libelle;
|
||||
private String code;
|
||||
private String indicatif;
|
||||
private String nationality;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "nationalite")
|
||||
private List<Personne> personnes;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package io.gmss.infocad.entities.decoupage;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Where(clause = " deleted = false")
|
||||
public class Quartier extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String code;
|
||||
private String nom;
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Arrondissement arrondissement;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package io.gmss.infocad.entities.infocad.metier;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import io.gmss.infocad.entities.infocad.parametre.Personne;
|
||||
import io.gmss.infocad.entities.infocad.parametre.PositionRepresentation;
|
||||
import io.gmss.infocad.entities.infocad.parametre.TypeContestation;
|
||||
import io.gmss.infocad.entities.infocad.parametre.TypeRepresentation;
|
||||
import io.gmss.infocad.enums.RoleActeur;
|
||||
import io.gmss.infocad.enums.TypeDroit;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@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)
|
||||
private Long id;
|
||||
private String observation;
|
||||
@Enumerated(EnumType.STRING)
|
||||
private TypeDroit typeDroit;
|
||||
private float part;
|
||||
@ManyToOne
|
||||
private TypeRepresentation typeRepresentation;
|
||||
@ManyToOne
|
||||
private PositionRepresentation positionRepresentation;
|
||||
@ManyToOne
|
||||
private Personne personne;
|
||||
@ManyToOne
|
||||
private TypeContestation typeContestation;
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Enquete enquete;
|
||||
@Enumerated(EnumType.STRING)
|
||||
private RoleActeur roleActeur;
|
||||
@OneToMany(mappedBy = "acteurConcerne")
|
||||
private List<Piece> pieces;
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Tpe terminal;
|
||||
@Column(nullable = false, columnDefinition = "BOOLEAN DEFAULT false")
|
||||
private boolean synchronise;
|
||||
//////////////////////////////
|
||||
private Long blocId;
|
||||
@ColumnDefault("0")
|
||||
private int haveDeclarant ;
|
||||
private Long max_numero_acteur_concerne_id ;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package io.gmss.infocad.entities.infocad.metier;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import io.gmss.infocad.entities.decoupage.Arrondissement;
|
||||
import io.gmss.infocad.entities.decoupage.Quartier;
|
||||
import io.gmss.infocad.entities.infocad.parametre.Structure;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SQLDelete(sql =
|
||||
"UPDATE bloc " +
|
||||
"SET deleted = true " +
|
||||
"WHERE id = ?")
|
||||
@Where(clause = " deleted = false")
|
||||
public class Bloc extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
@Column(updatable = false)
|
||||
private String cote;
|
||||
private String nom;
|
||||
@JsonIgnore
|
||||
private String idBlocParArrondissement;
|
||||
@JsonIgnore
|
||||
@Transient
|
||||
private String nomArrondissement;
|
||||
@ManyToMany
|
||||
@JoinTable(name = "blocs_quartiers",
|
||||
joinColumns = @JoinColumn(name = "bloc_id"),
|
||||
inverseJoinColumns = @JoinColumn(name = "quartier_id")
|
||||
)
|
||||
private Set<Quartier> quartiers;
|
||||
@ManyToOne
|
||||
private Arrondissement arrondissement;
|
||||
@ManyToOne
|
||||
private Structure structure;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "bloc")
|
||||
private List<Enquete> enquetes;
|
||||
public String getNomArrondissement() {
|
||||
return arrondissement.getNom();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package io.gmss.infocad.entities.infocad.metier;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import io.gmss.infocad.deserializer.LocalDateTimeDeserializer;
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import io.gmss.infocad.enums.Origine;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SQLDelete(sql =
|
||||
"UPDATE commentaire " +
|
||||
"SET deleted = true " +
|
||||
"WHERE id = ?")
|
||||
@Where(clause = " deleted = false")
|
||||
public class Commentaire extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
@JsonFormat(pattern = "dd-MM-yyyy HH:mm:ss")
|
||||
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
|
||||
private LocalDateTime dateCommentaire;
|
||||
private Long idEnquete;
|
||||
private String commentaire;
|
||||
private String nomPrenom;
|
||||
@Enumerated(EnumType.STRING)
|
||||
private Origine origine;
|
||||
private String nupParcelle;
|
||||
@Column(name = "lu", nullable = false, columnDefinition = "BOOLEAN DEFAULT false")
|
||||
private boolean lu = false;
|
||||
@Column(name = "synchronise", nullable = false, columnDefinition = "BOOLEAN DEFAULT false")
|
||||
private boolean synchronise = false;
|
||||
private Long externalKey;
|
||||
private Long terminalId;
|
||||
}
|
||||
@@ -0,0 +1,221 @@
|
||||
package io.gmss.infocad.entities.infocad.metier;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import io.gmss.infocad.deserializer.LocalDateDeserializer;
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import io.gmss.infocad.entities.decoupage.Arrondissement;
|
||||
import io.gmss.infocad.entities.infocad.parametre.NatureDomaine;
|
||||
import io.gmss.infocad.entities.rfu.metier.CaracteristiqueParcelle;
|
||||
import io.gmss.infocad.entities.rfu.metier.EnqueteBatiment;
|
||||
import io.gmss.infocad.entities.rfu.metier.EnqueteUniteLogement;
|
||||
import io.gmss.infocad.entities.user.User;
|
||||
import io.gmss.infocad.enums.StatusEnquete;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Type;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@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")
|
||||
public class Enquete extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateEnquete;
|
||||
private boolean litige;
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private User user;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "enquete")
|
||||
private List<ActeurConcerne> acteurConcernes;
|
||||
@ManyToOne
|
||||
private Parcelle parcelle;
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Bloc bloc;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
private StatusEnquete statusEnquete;
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateValidation;
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateRejet;
|
||||
@Type(type="text")
|
||||
private String descriptionMotifRejet;
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateFinalisation;
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateLitigeResolu;
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateSynchronisation;
|
||||
private boolean synchronise;
|
||||
@Type(type="text")
|
||||
private String observationParticuliere;
|
||||
@Transient
|
||||
private String nomPrenomEnqueteur;
|
||||
@Transient
|
||||
private String nomBloc;
|
||||
@Transient
|
||||
private String departement;
|
||||
@Transient
|
||||
private String commune;
|
||||
@Transient
|
||||
private String arrondissement;
|
||||
@Transient
|
||||
private String codeBloc;
|
||||
@Transient
|
||||
private String telEnqueteur;
|
||||
@Transient
|
||||
private String typeDomaine;
|
||||
|
||||
@Transient
|
||||
private String structureEnqueteur;
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Tpe terminal;
|
||||
@Transient
|
||||
private Long terminalId;
|
||||
|
||||
////////////////////////////////
|
||||
private Long quartierId;
|
||||
private Long arrondissementId;
|
||||
private Long communeId;
|
||||
private Long departementId;
|
||||
private Long numeroProvisoir;
|
||||
private String codeParcelle;
|
||||
private String nomProprietaireParcelle;
|
||||
private String codeEquipe;
|
||||
private String numeroTitreFoncier;
|
||||
|
||||
/// Nouveau champs ajoutés pour RFU Abomey
|
||||
private String numEnterParcelle;
|
||||
private String numRue;
|
||||
private String nomRue;
|
||||
private String emplacement;
|
||||
private float altitude;
|
||||
private float precision;
|
||||
private byte nbreCoProprietaire;
|
||||
private byte nbreIndivisiaire;
|
||||
private String autreAdresse;
|
||||
private String surface;
|
||||
private byte nbreBatiment;
|
||||
private byte nbrePiscine;
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateDebutExcemption;
|
||||
@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;
|
||||
|
||||
|
||||
public Long getTerminalId(){
|
||||
if(this.terminal!=null){
|
||||
return this.terminal.getId();
|
||||
}else return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getNomPrenomEnqueteur(){
|
||||
if(this.user!=null){
|
||||
return this.user.getNom()+" "+this.user.getPrenom();
|
||||
}else return "";
|
||||
}
|
||||
public String getNomBloc(){
|
||||
if(this.bloc!=null){
|
||||
return this.bloc.getNom();
|
||||
}else return "";
|
||||
}
|
||||
|
||||
public String getCodeBloc(){
|
||||
if(this.bloc!=null){
|
||||
return this.bloc.getCote();
|
||||
}else return "";
|
||||
}
|
||||
public String getDepartement(){
|
||||
if(this.bloc!=null){
|
||||
Arrondissement arrondissement= this.bloc.getArrondissement();
|
||||
if(arrondissement!=null){
|
||||
return arrondissement.getCommune().getDepartement().getNom();
|
||||
}else return "";
|
||||
}else return "";
|
||||
}
|
||||
public String getCommune(){
|
||||
if(this.bloc!=null){
|
||||
Arrondissement arrondissement= this.bloc.getArrondissement();
|
||||
if(arrondissement!=null){
|
||||
return arrondissement.getCommune().getNom();
|
||||
}else return "";
|
||||
}else return "";
|
||||
}
|
||||
|
||||
public String getArrondissement(){
|
||||
if(this.bloc!=null){
|
||||
Arrondissement arrondissement= this.bloc.getArrondissement();
|
||||
if(arrondissement!=null){
|
||||
return arrondissement.getNom();
|
||||
}else return "";
|
||||
}else return "";
|
||||
}
|
||||
public String getTypeDomaine(){
|
||||
if(this.parcelle!=null){
|
||||
NatureDomaine natureDomaine= this.parcelle.getNatureDomaine();
|
||||
if(natureDomaine!=null){
|
||||
return natureDomaine.getTypeDomaine().getLibelle();
|
||||
}else return "";
|
||||
}else return "";
|
||||
}
|
||||
|
||||
public String getTelEnqueteur(){
|
||||
if(this.user !=null){
|
||||
return this.user.getTel();
|
||||
}else return "";
|
||||
}
|
||||
|
||||
public String getStructureEnqueteur(){
|
||||
if(this.user !=null){
|
||||
return this.user.getStructure().getNom();
|
||||
}else return "";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package io.gmss.infocad.entities.infocad.metier;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import java.time.LocalDate;
|
||||
@Entity
|
||||
@Data
|
||||
public class EnqueteFiltreResponse{
|
||||
@Id
|
||||
private Long id;
|
||||
private String parcelleid;
|
||||
private Long communeid;
|
||||
private String communenom;
|
||||
private Long arrondissementid;
|
||||
private String arrondissementnom;
|
||||
private Long blocid;
|
||||
private String blocnom;
|
||||
private Long structureid;
|
||||
private String structurenom;
|
||||
private boolean litige;
|
||||
private String statusenquete;
|
||||
private LocalDate datefinalisation;
|
||||
private LocalDate datevalidation;
|
||||
private LocalDate datesynchronisation;
|
||||
private boolean synchronise;
|
||||
private String nomsigle;
|
||||
private String prenomraisonsociale;
|
||||
private String typepersonne;
|
||||
private String typedomaine;
|
||||
private String naturedomaine;
|
||||
private String nupprovisoire;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package io.gmss.infocad.entities.infocad.metier;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import io.gmss.infocad.entities.infocad.parametre.Personne;
|
||||
import io.gmss.infocad.entities.infocad.parametre.PositionRepresentation;
|
||||
import io.gmss.infocad.entities.infocad.parametre.TypeRepresentation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.Set;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Where(clause = " deleted = false")
|
||||
public class MembreGroupe extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
@ManyToOne
|
||||
private Personne personneRepresantee; // la personne que l'on représente (PM ou PP)
|
||||
@ManyToOne
|
||||
private Personne personneRepresantante; // la personne qui représente la personne représentee
|
||||
@ManyToOne
|
||||
private TypeRepresentation typeRepresentation;
|
||||
@ManyToOne
|
||||
private PositionRepresentation positionRepresentation;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "membreGroupe")
|
||||
private Set<Upload> uploads;
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Tpe terminal;
|
||||
|
||||
private Long max_numero_piece_id;
|
||||
private Long max_numero_acteur_concerne_id;
|
||||
private Long enqueteId;
|
||||
private Long blocId;
|
||||
private String observation;
|
||||
@ColumnDefault("false")
|
||||
private boolean synchronise;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package io.gmss.infocad.entities.infocad.metier;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import io.gmss.infocad.entities.decoupage.Quartier;
|
||||
import io.gmss.infocad.entities.infocad.parametre.NatureDomaine;
|
||||
import io.gmss.infocad.entities.rfu.metier.Batiment;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SQLDelete(sql =
|
||||
"UPDATE parcelle " +
|
||||
"SET deleted = true " +
|
||||
"WHERE id = ?")
|
||||
@Where(clause = " deleted = false")
|
||||
public class Parcelle extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
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;
|
||||
@ManyToOne
|
||||
//private TypeDomaine typeDomaine;
|
||||
private NatureDomaine natureDomaine;
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Quartier quartier;
|
||||
private String i;
|
||||
private String p;
|
||||
private String observation;
|
||||
private String numTitreFoncier;
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Tpe terminal;
|
||||
|
||||
private Long typeDomaineId;
|
||||
private Long numeroProvisoire;
|
||||
private Long blocId;
|
||||
@ColumnDefault("false")
|
||||
private boolean synchronise;
|
||||
|
||||
|
||||
private Long idDerniereEnquete;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "parcelle")
|
||||
private List<Batiment> batiments;
|
||||
|
||||
// @ColumnDefault("0")
|
||||
// private int geomSrid;
|
||||
//
|
||||
// @JsonSerialize(using = GeometrySerializer.class)
|
||||
// @JsonDeserialize(contentUsing = GeometryDeserializer.class)
|
||||
// @Column(name = "geom",columnDefinition = "geometry(MultiPolygon,4326)")
|
||||
// private Point geometry;
|
||||
//
|
||||
// @JsonSerialize(using = GeometrySerializer.class)
|
||||
// @JsonDeserialize(contentUsing = GeometryDeserializer.class)
|
||||
// @Column(name = "geom_32631",columnDefinition = "geometry(MultiPolygon,32631)")
|
||||
// private Point geometry32631;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package io.gmss.infocad.entities.infocad.metier;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import io.gmss.infocad.deserializer.LocalDateDeserializer;
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import io.gmss.infocad.entities.infocad.parametre.ModeAcquisition;
|
||||
import io.gmss.infocad.entities.infocad.parametre.Personne;
|
||||
import io.gmss.infocad.entities.infocad.parametre.SourceDroit;
|
||||
import io.gmss.infocad.entities.infocad.parametre.TypePiece;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SQLDelete(sql =
|
||||
"UPDATE piece " +
|
||||
"SET deleted = true " +
|
||||
"WHERE id = ?")
|
||||
@Where(clause = " deleted = false")
|
||||
public class Piece extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String url;
|
||||
private String numeroPiece;
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateExpiration;
|
||||
@ManyToOne
|
||||
private TypePiece typePiece;
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Personne personne;
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private ActeurConcerne acteurConcerne ;
|
||||
@ManyToOne
|
||||
private SourceDroit sourceDroit ;
|
||||
@ManyToOne
|
||||
private ModeAcquisition modeAcquisition ;
|
||||
@OneToMany(mappedBy = "piece")
|
||||
private List<Upload> uploads ;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Tpe terminal;
|
||||
|
||||
|
||||
private Long max_numero_piece_id;
|
||||
private Long max_numero_acteur_concerne_id;
|
||||
private Long enqueteId;
|
||||
private Long blocId;
|
||||
@ColumnDefault("false")
|
||||
private boolean synchronise;
|
||||
private String observation;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package io.gmss.infocad.entities.infocad.metier;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SQLDelete(sql =
|
||||
"UPDATE tpe " +
|
||||
"SET deleted = true " +
|
||||
"WHERE id = ?")
|
||||
@Where(clause = " deleted = false")
|
||||
public class Tpe extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String numeroEquipement;
|
||||
@Column(unique = true)
|
||||
private String identifier;
|
||||
private String model;
|
||||
private String codeEquipe;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "terminal")
|
||||
private List<Enquete> enquetes;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package io.gmss.infocad.entities.infocad.metier;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import io.gmss.infocad.entities.rfu.metier.Batiment;
|
||||
import io.gmss.infocad.entities.rfu.metier.UniteLogement;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
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;
|
||||
private String originalFileName;
|
||||
@Transient
|
||||
private String URIFile;
|
||||
private String checkSum;
|
||||
private long size;
|
||||
private String mimeType;
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Piece piece;
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private MembreGroupe membreGroupe;
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Tpe terminal;
|
||||
|
||||
private String name;
|
||||
private String filePath;
|
||||
private Long max_numero_piece_id;
|
||||
private Long max_numero_upload_id;
|
||||
private Long max_numero_acteur_concerne_id;
|
||||
private Long enqueteId;
|
||||
private Long blocId;
|
||||
|
||||
@ManyToOne
|
||||
private Batiment batiment;
|
||||
@ManyToOne
|
||||
private UniteLogement uniteLogement;
|
||||
|
||||
public Upload() {
|
||||
}
|
||||
|
||||
public String getURIFile() {
|
||||
return this.serverContext()+fileName;
|
||||
}
|
||||
|
||||
private String serverContext(){
|
||||
return ServletUriComponentsBuilder.fromCurrentContextPath()
|
||||
.path("/api/upload/downloadFile/")
|
||||
.toUriString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Upload{" +
|
||||
"id=" + id +
|
||||
", fileName='" + fileName + '\'' +
|
||||
", originalFileName='" + originalFileName + '\'' +
|
||||
'}';
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package io.gmss.infocad.entities.infocad.parametre;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import io.gmss.infocad.entities.infocad.metier.Piece;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SQLDelete(sql =
|
||||
"UPDATE mode_acquisition " +
|
||||
"SET deleted = true " +
|
||||
"WHERE id = ?")
|
||||
@Where(clause = " deleted = false")
|
||||
public class ModeAcquisition extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String libelle;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "modeAcquisition")
|
||||
//private List<SourceDroitExerce> sourceDroitExerces;
|
||||
private List<Piece> pieces ;
|
||||
@ManyToMany
|
||||
@JoinTable(name = "modeAcquisition_typePersonne",
|
||||
joinColumns = @JoinColumn(name = "mode_acquisition_id"),
|
||||
inverseJoinColumns = @JoinColumn(name = "type_personne_id")
|
||||
)
|
||||
private Set<TypePersonne> typePersonnes;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package io.gmss.infocad.entities.infocad.parametre;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import io.gmss.infocad.entities.infocad.metier.Parcelle;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SQLDelete(sql =
|
||||
"UPDATE nature_domaine " +
|
||||
"SET deleted = true " +
|
||||
"WHERE id = ?")
|
||||
@Where(clause = " deleted = false")
|
||||
public class NatureDomaine extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String libelle;
|
||||
//@JsonIgnore
|
||||
@ManyToOne
|
||||
private TypeDomaine typeDomaine;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "natureDomaine")
|
||||
private List<Parcelle> parcelles;
|
||||
@ManyToMany
|
||||
@JoinTable(name = "natureDomaine_typePersonne",
|
||||
joinColumns = @JoinColumn(name = "nature_domaine_id"),
|
||||
inverseJoinColumns = @JoinColumn(name = "type_personne_id")
|
||||
)
|
||||
private Set<TypePersonne> typePersonnes;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package io.gmss.infocad.entities.infocad.parametre;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import io.gmss.infocad.entities.decoupage.Commune;
|
||||
import io.gmss.infocad.entities.decoupage.Nationalite;
|
||||
import io.gmss.infocad.entities.infocad.metier.ActeurConcerne;
|
||||
import io.gmss.infocad.entities.infocad.metier.Piece;
|
||||
import io.gmss.infocad.entities.infocad.metier.Tpe;
|
||||
import io.gmss.infocad.enums.Categorie;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SQLDelete(sql =
|
||||
"UPDATE personne " +
|
||||
"SET deleted = true " +
|
||||
"WHERE id = ?")
|
||||
@Where(clause = " deleted = false")
|
||||
public class Personne extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String ifu;
|
||||
private String nomOuSigle;
|
||||
private String prenomOuRaisonSociale;
|
||||
private String numRavip;
|
||||
private String npi;
|
||||
private String dateNaissanceOuConsti;
|
||||
private String lieuNaissance;
|
||||
private String tel1;
|
||||
private String tel2;
|
||||
private String adresse;
|
||||
@Enumerated(EnumType.STRING)
|
||||
private Categorie categorie;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "personne")
|
||||
private List<ActeurConcerne> acteurConcernes;
|
||||
@ManyToOne
|
||||
private SituationMatrimoniale situationMatrimoniale;
|
||||
@ManyToOne
|
||||
private Nationalite nationalite;
|
||||
@ManyToOne
|
||||
private TypePersonne typePersonne;
|
||||
@ManyToOne
|
||||
private Profession profession;
|
||||
@ManyToOne
|
||||
private Commune commune;
|
||||
@OneToMany(mappedBy = "personne")
|
||||
private List<Piece> pieces;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Tpe terminal;
|
||||
@ColumnDefault("0")
|
||||
private int haveRepresentant;
|
||||
private String ravipQuestion;
|
||||
private String age;
|
||||
private String nomJeuneFille;
|
||||
private String nomMere;
|
||||
private String prenomMere;
|
||||
private String indicatifTel1;
|
||||
private String indicatifTel2;
|
||||
private String sexe;
|
||||
@ColumnDefault("0")
|
||||
private int mustHaveRepresentant;
|
||||
private String filePath;
|
||||
private String observation;
|
||||
@ColumnDefault("false")
|
||||
private boolean synchronise;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package io.gmss.infocad.entities.infocad.parametre;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import io.gmss.infocad.entities.infocad.metier.ActeurConcerne;
|
||||
import io.gmss.infocad.entities.infocad.metier.MembreGroupe;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SQLDelete(sql =
|
||||
"UPDATE position_representation " +
|
||||
"SET deleted = true " +
|
||||
"WHERE id = ?")
|
||||
@Where(clause = " deleted = false")
|
||||
public class PositionRepresentation extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String libelle;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "positionRepresentation")
|
||||
private List<ActeurConcerne> acteurConcernes;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "positionRepresentation")
|
||||
private List<MembreGroupe> membreGroupes;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package io.gmss.infocad.entities.infocad.parametre;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SQLDelete(sql =
|
||||
"UPDATE profession " +
|
||||
"SET deleted = true " +
|
||||
"WHERE id = ?")
|
||||
@Where(clause = " deleted = false")
|
||||
public class Profession extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String code;
|
||||
private String libelle;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "profession")
|
||||
private List<Personne> personnes;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package io.gmss.infocad.entities.infocad.parametre;
|
||||
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import java.io.Serializable;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SQLDelete(sql =
|
||||
"UPDATE situation_geographique " +
|
||||
"SET deleted = true " +
|
||||
"WHERE id = ?")
|
||||
@Where(clause = " deleted = false")
|
||||
public class SituationGeographique extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String libelle;
|
||||
// @JsonIgnore
|
||||
// @OneToMany(mappedBy = "situationGeographique")
|
||||
// private List<Parcelle> parcelles;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package io.gmss.infocad.entities.infocad.parametre;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SQLDelete(sql =
|
||||
"UPDATE situation_matrimoniale " +
|
||||
"SET deleted = true " +
|
||||
"WHERE id = ?")
|
||||
@Where(clause = " deleted = false")
|
||||
public class SituationMatrimoniale extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String libelle;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "situationMatrimoniale")
|
||||
private List<Personne> personnes;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package io.gmss.infocad.entities.infocad.parametre;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import io.gmss.infocad.entities.infocad.metier.Piece;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SQLDelete(sql =
|
||||
"UPDATE source_droit " +
|
||||
"SET deleted = true " +
|
||||
"WHERE id = ?")
|
||||
@Where(clause = " deleted = false")
|
||||
public class SourceDroit extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String libelle;
|
||||
@Column(columnDefinition = "integer default 1")
|
||||
private int tailleChampMin;
|
||||
@Column(columnDefinition = "integer default 5")
|
||||
private int tailleChampMax;
|
||||
@Column(columnDefinition = "varchar(255) default 'text'")
|
||||
private String typeChamp;
|
||||
@Column(columnDefinition = "boolean default false")
|
||||
private boolean temoin;
|
||||
@ManyToMany
|
||||
@JoinTable(name = "sourcesDeDroits_ModesAcquisitions",
|
||||
joinColumns = @JoinColumn(name = "sources_droits_id"),
|
||||
inverseJoinColumns = @JoinColumn(name = "modes_acquisitions_id")
|
||||
)
|
||||
private Set<ModeAcquisition> modeAcquisitions;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "sourceDroit")
|
||||
//private List<SourceDroitExerce> sourceDroitExerces;
|
||||
private List<Piece> pieces ;
|
||||
@Column(columnDefinition = "boolean default false")
|
||||
private boolean titreFoncier;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package io.gmss.infocad.entities.infocad.parametre;
|
||||
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import io.gmss.infocad.entities.infocad.metier.ActeurConcerne;
|
||||
import io.gmss.infocad.entities.infocad.metier.Piece;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.Set;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SQLDelete(sql =
|
||||
"UPDATE source_droit_exerce " +
|
||||
"SET deleted = true " +
|
||||
"WHERE id = ?")
|
||||
@Where(clause = " deleted = false")
|
||||
public class SourceDroitExerce extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String libelle;
|
||||
@ManyToOne
|
||||
private SourceDroit sourceDroit;
|
||||
@ManyToOne
|
||||
private ActeurConcerne acteurConcerne;
|
||||
@ManyToMany
|
||||
@JoinTable(name = "pieces_sources_droits_exerces",
|
||||
joinColumns = @JoinColumn(name = "sources_droits_exerce_id"),
|
||||
inverseJoinColumns = @JoinColumn(name = "piece_id")
|
||||
)
|
||||
private Set<Piece> pieces;
|
||||
@ManyToOne
|
||||
private ModeAcquisition modeAcquisition;
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package io.gmss.infocad.entities.infocad.parametre;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import io.gmss.infocad.entities.decoupage.Arrondissement;
|
||||
import io.gmss.infocad.entities.infocad.metier.Bloc;
|
||||
import io.gmss.infocad.entities.user.User;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SQLDelete(sql =
|
||||
"UPDATE structure " +
|
||||
"SET deleted = true " +
|
||||
"WHERE id = ?")
|
||||
@Where(clause = " deleted = false")
|
||||
public class Structure extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
@Column(updatable = false)
|
||||
private String code;
|
||||
private String nom;
|
||||
private String ifu;
|
||||
private String rccm;
|
||||
private String tel;
|
||||
private String email;
|
||||
private String adresse;
|
||||
//@JsonIgnore
|
||||
@ManyToMany
|
||||
@JoinTable(name = "arrondissements_structures",
|
||||
joinColumns = @JoinColumn(name = "structure_id"),
|
||||
inverseJoinColumns = @JoinColumn(name = "arrondissement_id")
|
||||
)
|
||||
private Set<Arrondissement> arrondissements;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "structure")
|
||||
private List<User> agents;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "structure")
|
||||
private List<Bloc> blocs;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package io.gmss.infocad.entities.infocad.parametre;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import io.gmss.infocad.entities.infocad.metier.ActeurConcerne;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SQLDelete(sql =
|
||||
"UPDATE type_contestation " +
|
||||
"SET deleted = true " +
|
||||
"WHERE id = ?")
|
||||
@Where(clause = " deleted = false")
|
||||
public class TypeContestation extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String libelle;
|
||||
@ColumnDefault("true")
|
||||
private boolean droitPropriete;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "typeContestation")
|
||||
private List<ActeurConcerne> acteurConcernes;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package io.gmss.infocad.entities.infocad.parametre;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SQLDelete(sql =
|
||||
"UPDATE type_domaine " +
|
||||
"SET deleted = true " +
|
||||
"WHERE id = ?")
|
||||
@Where(clause = " deleted = false")
|
||||
public class TypeDomaine extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String libelle;
|
||||
// @JsonIgnore
|
||||
// @OneToMany(mappedBy = "typeDomaine")
|
||||
// private List<Parcelle> parcelles;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "typeDomaine")
|
||||
private List<NatureDomaine> natureDomaines;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package io.gmss.infocad.entities.infocad.parametre;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import io.gmss.infocad.enums.Categorie;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SQLDelete(sql =
|
||||
"UPDATE type_personne " +
|
||||
"SET deleted = true " +
|
||||
"WHERE id = ?")
|
||||
@Where(clause = " deleted = false")
|
||||
public class TypePersonne extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String libelle;
|
||||
@Enumerated(EnumType.STRING)
|
||||
private Categorie categorie;
|
||||
@Column(nullable = false, columnDefinition = "BOOLEAN DEFAULT false")
|
||||
private boolean groupeOuvert;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "typePersonne")
|
||||
private List<Personne> personnes;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package io.gmss.infocad.entities.infocad.parametre;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import io.gmss.infocad.entities.infocad.metier.Piece;
|
||||
import io.gmss.infocad.enums.CategoriePiece;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SQLDelete(sql =
|
||||
"UPDATE type_piece " +
|
||||
"SET deleted = true " +
|
||||
"WHERE id = ?")
|
||||
@Where(clause = " deleted = false")
|
||||
public class TypePiece extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String libelle;
|
||||
@Enumerated(EnumType.STRING)
|
||||
private CategoriePiece categoriePiece;
|
||||
@ColumnDefault("true")
|
||||
private boolean temoin;
|
||||
@ColumnDefault("true")
|
||||
private boolean contestataire;
|
||||
@ColumnDefault("true")
|
||||
private boolean declarant;
|
||||
@Column(columnDefinition = "integer default 1")
|
||||
private int tailleChampMin;
|
||||
@Column(columnDefinition = "integer default 5")
|
||||
private int tailleChampMax;
|
||||
@Column(columnDefinition = "varchar(255) default 'text'")
|
||||
private String typeChamp;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "typePiece")
|
||||
private List<Piece> pieces;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package io.gmss.infocad.entities.infocad.parametre;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import io.gmss.infocad.entities.infocad.metier.ActeurConcerne;
|
||||
import io.gmss.infocad.entities.infocad.metier.MembreGroupe;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SQLDelete(sql =
|
||||
"UPDATE type_representation " +
|
||||
"SET deleted = true " +
|
||||
"WHERE id = ?")
|
||||
@Where(clause = " deleted = false")
|
||||
public class TypeRepresentation extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String libelle;
|
||||
@Column(columnDefinition = "boolean default false")
|
||||
private boolean estUnique;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "typeRepresentation")
|
||||
private List<ActeurConcerne> acteurConcernes;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "typeRepresentation")
|
||||
private List<MembreGroupe> membreGroupes;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package io.gmss.infocad.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.infocad.deserializer.LocalDateDeserializer;
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import io.gmss.infocad.entities.infocad.metier.Parcelle;
|
||||
import io.gmss.infocad.entities.infocad.metier.Upload;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Where(clause = " deleted = false")
|
||||
public class Batiment extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String nub;
|
||||
private String code;
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateConstruction;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "batiment")
|
||||
private List<EnqueteBatiment> enqueteBatiments;
|
||||
private Long idDerniereEnquete;
|
||||
@ManyToOne
|
||||
private Parcelle parcelle;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "batiment")
|
||||
private List<UniteLogement> uniteLogements;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "batiment")
|
||||
private List<Upload> uploads;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package io.gmss.infocad.entities.rfu.metier;
|
||||
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import io.gmss.infocad.entities.rfu.parametre.Caracteristique;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@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
|
||||
private EnqueteBatiment enqueteBatiment;
|
||||
@ManyToOne
|
||||
private Caracteristique caracteristique;
|
||||
private String valeur;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package io.gmss.infocad.entities.rfu.metier;
|
||||
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import io.gmss.infocad.entities.infocad.metier.Enquete;
|
||||
import io.gmss.infocad.entities.rfu.parametre.Caracteristique;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@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;
|
||||
@ManyToOne
|
||||
private Enquete enquete;
|
||||
@ManyToOne
|
||||
private Caracteristique caracteristique;
|
||||
private String valeur;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package io.gmss.infocad.entities.rfu.metier;
|
||||
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import io.gmss.infocad.entities.rfu.parametre.Caracteristique;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@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
|
||||
private EnqueteUniteLogement enqueteUniteLogement;
|
||||
@ManyToOne
|
||||
private Caracteristique caracteristique;
|
||||
private String valeur;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package io.gmss.infocad.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.infocad.deserializer.LocalDateDeserializer;
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import io.gmss.infocad.entities.infocad.metier.Enquete;
|
||||
import io.gmss.infocad.entities.infocad.parametre.Personne;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SQLDelete(sql =
|
||||
"UPDATE enquete_batiment " +
|
||||
"SET deleted = true " +
|
||||
"WHERE id = ?")
|
||||
@Where(clause = " deleted = false")
|
||||
public class EnqueteBatiment extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private float surfaceAuSol;
|
||||
private String autreMenuisierie;
|
||||
private String autreMur;
|
||||
private boolean sbee;
|
||||
private String numCompteurSbee;
|
||||
private boolean soneb;
|
||||
private String numCompteurSoneb;
|
||||
private byte nbreLotUnite;
|
||||
private byte nbreUniteLocation;
|
||||
private float surfaceLouee;
|
||||
private byte nbreMenage;
|
||||
private byte nbreHabitant;
|
||||
private float valeurMensuelleLocation;
|
||||
private byte nbreMoisLocation;
|
||||
private String autreCaracteristiquePhysique;
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateDebutExcemption;
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateFinExcemption;
|
||||
@OneToOne
|
||||
private Personne personne;
|
||||
@ManyToOne
|
||||
private Batiment batiment;
|
||||
@ManyToOne
|
||||
private Enquete enquete;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "enqueteBatiment")
|
||||
List<CaracteristiqueBatiment> caracteristiqueBatiments;
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package io.gmss.infocad.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.infocad.deserializer.LocalDateDeserializer;
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import io.gmss.infocad.entities.infocad.metier.Enquete;
|
||||
import io.gmss.infocad.entities.infocad.parametre.Personne;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SQLDelete(sql =
|
||||
"UPDATE enquete_unite_logement " +
|
||||
"SET deleted = true " +
|
||||
"WHERE id = ?")
|
||||
@Where(clause = " deleted = false")
|
||||
public class EnqueteUniteLogement extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private float surface;
|
||||
private byte nbrePiece; //les champs byte sont des integer,
|
||||
// c'est juste la taille en mémoire que je veux préserver
|
||||
private byte nbreHabitant;
|
||||
private byte nbreMenage;
|
||||
private boolean enLocation;
|
||||
private float montantMensuelLoyer;
|
||||
private byte nbreMoisEnLocation;
|
||||
private float montantLocatifAnnuelDeclare;
|
||||
private float surfaceLouee;
|
||||
private boolean sbee;
|
||||
private boolean soneb;
|
||||
private String numCompteurSbee;
|
||||
private String numCompteurSoneb;
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateDebutExcemption;
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateFinExcemption;
|
||||
@ManyToOne
|
||||
private Enquete enquete;
|
||||
@ManyToOne
|
||||
private UniteLogement uniteLogement;
|
||||
@OneToOne
|
||||
private Personne personne;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "enqueteUniteLogement")
|
||||
private List<CaracteristiqueUniteLogement> caracteristiqueUniteLogements;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package io.gmss.infocad.entities.rfu.metier;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import io.gmss.infocad.entities.infocad.metier.Upload;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Where(clause = " deleted = false")
|
||||
public class UniteLogement extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String nul;
|
||||
private String numeroEtage;
|
||||
private String code;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "uniteLogement")
|
||||
private List<EnqueteUniteLogement> enqueteUniteLogements;
|
||||
@ManyToOne
|
||||
private Batiment batiment;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "uniteLogement")
|
||||
private List<Upload> uploads;
|
||||
private Long idDerniereEnquete;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package io.gmss.infocad.entities.rfu.parametre;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import io.gmss.infocad.entities.rfu.metier.CaracteristiqueBatiment;
|
||||
import io.gmss.infocad.entities.rfu.metier.CaracteristiqueUniteLogement;
|
||||
import io.gmss.infocad.enums.TypeImmeuble;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Where(clause = " deleted = false")
|
||||
public class Caracteristique extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String code;
|
||||
private String libelle;
|
||||
private boolean actif;
|
||||
private TypeImmeuble typeImmeuble;
|
||||
@ManyToOne
|
||||
private TypeCaracteristique typeCaracteristique;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "caracteristique")
|
||||
private List<CaracteristiqueBatiment> caracteristiqueBatiments;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "caracteristique")
|
||||
private List<CaracteristiqueUniteLogement> caracteristiqueUniteLogements;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package io.gmss.infocad.entities.rfu.parametre;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import io.gmss.infocad.enums.TypeImmeuble;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Where(clause = " deleted = false")
|
||||
public class TypeCaracteristique extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String code;
|
||||
private String libelle;
|
||||
private boolean actif;
|
||||
private boolean bati;
|
||||
private boolean nonBati;
|
||||
private TypeImmeuble typeImmeuble;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "typeCaracteristique")
|
||||
private List<Caracteristique> caracteristiques;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package io.gmss.infocad.entities.user;
|
||||
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import io.gmss.infocad.enums.EtatDemande;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SQLDelete(sql =
|
||||
"UPDATE tpe " +
|
||||
"SET deleted = true " +
|
||||
"WHERE id = ?")
|
||||
@Where(clause = " deleted = false")
|
||||
public class DemandeReinitialisationMP extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
@ManyToOne
|
||||
private User user;
|
||||
@Enumerated(EnumType.STRING)
|
||||
private EtatDemande etatDemande;
|
||||
}
|
||||
51
src/main/java/io/gmss/infocad/entities/user/Role.java
Executable file
51
src/main/java/io/gmss/infocad/entities/user/Role.java
Executable file
@@ -0,0 +1,51 @@
|
||||
package io.gmss.infocad.entities.user;
|
||||
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import io.gmss.infocad.enums.UserRole;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Entity
|
||||
public class Role extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
@Enumerated(EnumType.STRING)
|
||||
private UserRole nom;
|
||||
private String description;
|
||||
|
||||
public Role(UserRole name, String description) {
|
||||
this.nom = name;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
|
||||
// If the object is compared with itself then return true
|
||||
if (o == this) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Check if o is an instance of Complex or not
|
||||
"null instanceof [type]" also returns false */
|
||||
if (!(o instanceof Role)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// typecast o to Complex so that we can compare data members
|
||||
Role r = (Role) o;
|
||||
|
||||
// Compare the data members and return accordingly
|
||||
return r.getNom().equals(this.getNom());
|
||||
}
|
||||
}
|
||||
72
src/main/java/io/gmss/infocad/entities/user/User.java
Executable file
72
src/main/java/io/gmss/infocad/entities/user/User.java
Executable file
@@ -0,0 +1,72 @@
|
||||
package io.gmss.infocad.entities.user;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.gmss.infocad.entities.BaseEntity;
|
||||
import io.gmss.infocad.entities.infocad.metier.Enquete;
|
||||
import io.gmss.infocad.entities.infocad.parametre.Structure;
|
||||
import io.gmss.infocad.enums.UserRole;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SQLDelete(sql =
|
||||
"UPDATE users " +
|
||||
"SET deleted = true " +
|
||||
"WHERE id = ?")
|
||||
@Where(clause = " deleted = false")
|
||||
@Table(name = "users")
|
||||
public class User extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String nom;
|
||||
private String prenom;
|
||||
private String tel;
|
||||
private String email;
|
||||
@JsonIgnore
|
||||
private String username;
|
||||
private String password;
|
||||
@Column(columnDefinition = "boolean default true")
|
||||
private boolean active;
|
||||
@Column(columnDefinition = "boolean default false")
|
||||
private boolean resetPassword;
|
||||
@ManyToMany
|
||||
@JoinTable(name = "users_roles",
|
||||
joinColumns = @JoinColumn(name = "user_id"),
|
||||
inverseJoinColumns = @JoinColumn(name = "roles_id")
|
||||
)
|
||||
private Set<Role> roles;
|
||||
@ManyToOne
|
||||
private Structure structure;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "user")
|
||||
private List<Enquete> enquetes;
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = this.email;
|
||||
}
|
||||
|
||||
public boolean isAdmin(){
|
||||
for(Role r:this.roles ){
|
||||
if(r.getNom().equals(UserRole.ROLE_ADMIN)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
8
src/main/java/io/gmss/infocad/enums/Categorie.java
Normal file
8
src/main/java/io/gmss/infocad/enums/Categorie.java
Normal file
@@ -0,0 +1,8 @@
|
||||
package io.gmss.infocad.enums;
|
||||
|
||||
public enum Categorie {
|
||||
|
||||
PERSONNE_PHYSIQUE,
|
||||
PERSONNE_MORALE,
|
||||
GROUPE_INFORMEL
|
||||
}
|
||||
9
src/main/java/io/gmss/infocad/enums/CategoriePiece.java
Normal file
9
src/main/java/io/gmss/infocad/enums/CategoriePiece.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package io.gmss.infocad.enums;
|
||||
|
||||
public enum CategoriePiece {
|
||||
|
||||
PERSONNE_PHYSIQUE,
|
||||
PERSONNE_MORALE,
|
||||
GROUPE,
|
||||
PARCELLE
|
||||
}
|
||||
6
src/main/java/io/gmss/infocad/enums/EtatDemande.java
Normal file
6
src/main/java/io/gmss/infocad/enums/EtatDemande.java
Normal file
@@ -0,0 +1,6 @@
|
||||
package io.gmss.infocad.enums;
|
||||
|
||||
public enum EtatDemande {
|
||||
TRAITE,
|
||||
NON_TRAITE
|
||||
}
|
||||
6
src/main/java/io/gmss/infocad/enums/FormatRapport.java
Normal file
6
src/main/java/io/gmss/infocad/enums/FormatRapport.java
Normal file
@@ -0,0 +1,6 @@
|
||||
package io.gmss.infocad.enums;
|
||||
|
||||
public enum FormatRapport {
|
||||
PDF,
|
||||
XLS;
|
||||
}
|
||||
6
src/main/java/io/gmss/infocad/enums/Origine.java
Normal file
6
src/main/java/io/gmss/infocad/enums/Origine.java
Normal file
@@ -0,0 +1,6 @@
|
||||
package io.gmss.infocad.enums;
|
||||
|
||||
public enum Origine {
|
||||
WEB,
|
||||
MOBILE
|
||||
}
|
||||
8
src/main/java/io/gmss/infocad/enums/PaymentStatus.java
Normal file
8
src/main/java/io/gmss/infocad/enums/PaymentStatus.java
Normal file
@@ -0,0 +1,8 @@
|
||||
package io.gmss.infocad.enums;
|
||||
|
||||
public enum PaymentStatus {
|
||||
SUCCESS,
|
||||
PENDING,
|
||||
FAILED,
|
||||
REFUNDED
|
||||
}
|
||||
10
src/main/java/io/gmss/infocad/enums/RoleActeur.java
Normal file
10
src/main/java/io/gmss/infocad/enums/RoleActeur.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package io.gmss.infocad.enums;
|
||||
|
||||
public enum RoleActeur {
|
||||
|
||||
PROPRIETAIRE,
|
||||
TEMOIN,
|
||||
CONTESTATAIRE,
|
||||
DECLARANT,
|
||||
MEMBRE
|
||||
}
|
||||
6
src/main/java/io/gmss/infocad/enums/Sexe.java
Normal file
6
src/main/java/io/gmss/infocad/enums/Sexe.java
Normal file
@@ -0,0 +1,6 @@
|
||||
package io.gmss.infocad.enums;
|
||||
|
||||
public enum Sexe {
|
||||
MASCULIN,
|
||||
FEMININ
|
||||
}
|
||||
9
src/main/java/io/gmss/infocad/enums/StatusEnquete.java
Executable file
9
src/main/java/io/gmss/infocad/enums/StatusEnquete.java
Executable file
@@ -0,0 +1,9 @@
|
||||
package io.gmss.infocad.enums;
|
||||
|
||||
public enum StatusEnquete {
|
||||
EN_COURS,
|
||||
FINALISE,
|
||||
REJETE,
|
||||
VALIDE,
|
||||
SYNCHRONISE
|
||||
}
|
||||
7
src/main/java/io/gmss/infocad/enums/TypeDroit.java
Normal file
7
src/main/java/io/gmss/infocad/enums/TypeDroit.java
Normal file
@@ -0,0 +1,7 @@
|
||||
package io.gmss.infocad.enums;
|
||||
|
||||
public enum TypeDroit {
|
||||
PROPRIETE,
|
||||
PRESUME_PROPRIETE,
|
||||
AUTRE
|
||||
}
|
||||
7
src/main/java/io/gmss/infocad/enums/TypeImmeuble.java
Normal file
7
src/main/java/io/gmss/infocad/enums/TypeImmeuble.java
Normal file
@@ -0,0 +1,7 @@
|
||||
package io.gmss.infocad.enums;
|
||||
|
||||
public enum TypeImmeuble {
|
||||
PARCELLE,
|
||||
BATIMENT,
|
||||
UNITE_LOGEMENT
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user