gestion revu de code en utilisant uniquement les DTO #85
6
pom.xml
6
pom.xml
@@ -149,6 +149,12 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.wildbit.java</groupId>
|
||||
<artifactId>postmark</artifactId>
|
||||
<version>1.7.6</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
<dependencyManagement>
|
||||
|
||||
@@ -10,6 +10,8 @@ import io.gmss.fiscad.paylaods.request.EnqueteTraitementPayLoad;
|
||||
import io.gmss.fiscad.paylaods.request.FiltreEnquetePayLoad;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.EnquetePayLoadWeb;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.ParcellePayLoadWeb;
|
||||
import io.gmss.fiscad.security.CurrentUser;
|
||||
import io.gmss.fiscad.security.UserPrincipal;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
@@ -118,12 +120,67 @@ public class ParcelleController {
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
// @GetMapping("/all/by-decoupage")
|
||||
// public ResponseEntity<?> getAllByDecoupage() {
|
||||
// try {
|
||||
// return new ResponseEntity<>(
|
||||
// new ApiResponse<>(true, enqueteService.getEnqueteCommuneArrondBloc(), "Liste des enquetes chargée avec succès."),
|
||||
// HttpStatus.OK
|
||||
// );
|
||||
// } catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
// logger.error(e.getLocalizedMessage());
|
||||
// return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
// } catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
// FileStorageException e) {
|
||||
// logger.error(e.getLocalizedMessage());
|
||||
// return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
// } catch (NullPointerException e) {
|
||||
// logger.error(e.getLocalizedMessage());
|
||||
// return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
// } catch (Exception e) {
|
||||
// logger.error(e.getLocalizedMessage());
|
||||
// return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
// }
|
||||
// }
|
||||
@GetMapping("/id/{id}")
|
||||
public ResponseEntity<?> getParcelleById(@CurrentUser UserPrincipal currentUser, @PathVariable Long id) {
|
||||
try {
|
||||
if(currentUser==null)
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,null, "Vous ne pouvez pas accéder à cette ressource"),
|
||||
HttpStatus.OK
|
||||
);
|
||||
Long userId = currentUser.getUser().getId();
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, parcelleService.getParcelleByIdToDto(userId,id), "enquete trouvé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<?> getAllParcelle() {
|
||||
public ResponseEntity<?> getAllParcelle(@CurrentUser UserPrincipal currentUser) {
|
||||
try {
|
||||
if(currentUser==null)
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, parcelleService.getParcelleList(), "Liste des enquetes chargée avec succès."),
|
||||
new ApiResponse<>(true,null, "Vous ne pouvez pas accéder à cette ressource"),
|
||||
HttpStatus.OK
|
||||
);
|
||||
Long userId = currentUser.getUser().getId();
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, parcelleService.getParcelleListToDto(userId), "Liste des enquetes chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
@@ -142,37 +199,19 @@ public class ParcelleController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/all/by-decoupage")
|
||||
public ResponseEntity<?> getAllByDecoupage() {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteService.getEnqueteCommuneArrondBloc(), "Liste des enquetes chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/all-paged")
|
||||
public ResponseEntity<?> getAllEnquetePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
public ResponseEntity<?> getAllParcellePaged(@CurrentUser UserPrincipal currentUser,@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
if(currentUser==null)
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, parcelleService.getParcelleList(pageable), "Liste des enquetes chargée avec succès."),
|
||||
new ApiResponse<>(true,null, "Vous ne pouvez pas accéder à cette ressource"),
|
||||
HttpStatus.OK
|
||||
);
|
||||
Long userId = currentUser.getUser().getId();
|
||||
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, parcelleService.getParcelleListPageableToDto(userId,pageable), "Liste des enquetes chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
@@ -191,13 +230,17 @@ public class ParcelleController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping("/id/{id}")
|
||||
public ResponseEntity<?> getStructureById(@PathVariable Long id) {
|
||||
@GetMapping("/all/by-quartier-id/{quartierId}")
|
||||
public ResponseEntity<?> getAllParcelleByQuartier(@CurrentUser UserPrincipal currentUser,@PathVariable Long quartierId) {
|
||||
try {
|
||||
if(currentUser==null)
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, parcelleService.getParcelleById(id), "enquete trouvé avec succès."),
|
||||
new ApiResponse<>(true,null, "Vous ne pouvez pas accéder à cette ressource"),
|
||||
HttpStatus.OK
|
||||
);
|
||||
Long userId = currentUser.getUser().getId();
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, parcelleService.getParcelleListByQuartierToDto(userId,quartierId), "Liste des enquetes chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
@@ -216,14 +259,19 @@ public class ParcelleController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping("/user-id/{userId}")
|
||||
public ResponseEntity<?> getParcellesByUserId(@PathVariable Long userId,@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
@GetMapping("/all-paged/by-quartier-id/{quartierId}")
|
||||
public ResponseEntity<?> getAllParcelleByQuartierPaged(@CurrentUser UserPrincipal currentUser,@PathVariable Long quartierId, @RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
if(currentUser==null)
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, parcelleService.getParcelleDataTableListByUserId(userId,pageable), "enquete trouvé avec succès."),
|
||||
new ApiResponse<>(true,null, "Vous ne pouvez pas accéder à cette ressource"),
|
||||
HttpStatus.OK
|
||||
);
|
||||
Long userId = currentUser.getUser().getId();
|
||||
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, parcelleService.getParcelleListByQuartierPageableToDto(userId,quartierId,pageable), "Liste des enquetes chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
@@ -243,6 +291,96 @@ public class ParcelleController {
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/all/by-rue-id/{rueId}")
|
||||
public ResponseEntity<?> getAllParcelleByRue(@CurrentUser UserPrincipal currentUser,@PathVariable Long rueId) {
|
||||
try {
|
||||
if(currentUser==null)
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,null, "Vous ne pouvez pas accéder à cette ressource"),
|
||||
HttpStatus.OK
|
||||
);
|
||||
Long userId = currentUser.getUser().getId();
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, parcelleService.getParcelleListByRueToDto(userId,rueId), "Liste des enquetes chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all-paged/by-rue-id/{rueId}")
|
||||
public ResponseEntity<?> getAllParcelleByRuePaged(@CurrentUser UserPrincipal currentUser,@PathVariable Long rueId, @RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
if(currentUser==null)
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,null, "Vous ne pouvez pas accéder à cette ressource"),
|
||||
HttpStatus.OK
|
||||
);
|
||||
Long userId = currentUser.getUser().getId();
|
||||
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, parcelleService.getParcelleListByRuePageableToDto(userId,rueId,pageable), "Liste des enquetes chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// @GetMapping("/user-id/{userId}")
|
||||
// public ResponseEntity<?> getParcellesByUserId(@PathVariable Long userId,@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
// try {
|
||||
// Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
// return new ResponseEntity<>(
|
||||
// new ApiResponse<>(true, parcelleService.getParcelleDataTableListByUserId(userId,pageable), "enquete trouvé avec succès."),
|
||||
// HttpStatus.OK
|
||||
// );
|
||||
// } catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
// logger.error(e.getLocalizedMessage());
|
||||
// return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
// } catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
// FileStorageException e) {
|
||||
// logger.error(e.getLocalizedMessage());
|
||||
// return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
// } catch (NullPointerException e) {
|
||||
// logger.error(e.getLocalizedMessage());
|
||||
// return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
// } catch (Exception e) {
|
||||
// logger.error(e.getLocalizedMessage());
|
||||
// return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ public class UserController {
|
||||
@PostMapping("/reset-password")
|
||||
public ResponseEntity<?> resetUserPassword(@RequestBody @Valid @Validated Login login) {
|
||||
try {
|
||||
UserPaylaodWeb userPaylaodWeb= userService.resetPassword(login.getUsername(), login.getPassword());
|
||||
UserPaylaodWeb userPaylaodWeb= userService.resetPassword(login.getUsername());
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, userPaylaodWeb, "Votre mot de passe à été réinitialisée avec succès."),
|
||||
HttpStatus.OK
|
||||
@@ -163,31 +163,37 @@ public class UserController {
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/activate-or-not/{id}")
|
||||
public ResponseEntity<?> acitvateOrNotUser(@PathVariable Long id) {
|
||||
@GetMapping("/activate/{id}")
|
||||
public ResponseEntity<?> acitvateUser(@PathVariable Long id) {
|
||||
try {
|
||||
|
||||
User user = userService.getUserById(id);
|
||||
// if(user.getAvoirFonctions().isEmpty()){
|
||||
// return new ResponseEntity<>(
|
||||
// new ApiResponse<>(false, user , "Ce compte n'est pas encore validé."),
|
||||
// HttpStatus.OK
|
||||
// );
|
||||
// }
|
||||
|
||||
if(user.isResetPassword()){
|
||||
User user = userService.activateUser(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, user , "Ce compte n'est pas encore validé."),
|
||||
new ApiResponse<>(true, user, "Utilisateur activé avec succès"),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
user = userService.activateOrNotUser(id);
|
||||
String message = "Utilisateur activé avec succès";
|
||||
if (!user.isActive()) {
|
||||
message = "Utilisateur désactivé avec succès";
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/desactivate/{id}")
|
||||
public ResponseEntity<?> disacitvateUser(@PathVariable Long id) {
|
||||
try {
|
||||
User user = userService.disactivateUser(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, user, message),
|
||||
new ApiResponse<>(true, user, "Utilisateur désactivé avec succès"),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
@@ -330,14 +336,6 @@ public class UserController {
|
||||
|
||||
}
|
||||
|
||||
// @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) {
|
||||
|
||||
28
src/main/java/io/gmss/fiscad/entities/Parameters.java
Executable file
28
src/main/java/io/gmss/fiscad/entities/Parameters.java
Executable file
@@ -0,0 +1,28 @@
|
||||
package io.gmss.fiscad.entities;
|
||||
|
||||
import io.gmss.fiscad.entities.audit.UserDateAudit;
|
||||
import io.gmss.fiscad.enums.ParametersType;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class Parameters extends UserDateAudit implements Serializable {
|
||||
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
@Enumerated(EnumType.STRING)
|
||||
private ParametersType name;
|
||||
private String value;
|
||||
|
||||
public Parameters() {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
43
src/main/java/io/gmss/fiscad/entities/audit/DateAudit.java
Executable file
43
src/main/java/io/gmss/fiscad/entities/audit/DateAudit.java
Executable file
@@ -0,0 +1,43 @@
|
||||
package io.gmss.fiscad.entities.audit;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import jakarta.persistence.EntityListeners;
|
||||
import jakarta.persistence.MappedSuperclass;
|
||||
import org.springframework.data.annotation.CreatedDate;
|
||||
import org.springframework.data.annotation.LastModifiedDate;
|
||||
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.Instant;
|
||||
|
||||
@MappedSuperclass
|
||||
@EntityListeners(AuditingEntityListener.class)
|
||||
public abstract class DateAudit implements Serializable {
|
||||
|
||||
@JsonIgnore
|
||||
@CreatedDate
|
||||
// @Column(updatable = false)
|
||||
private Instant createdAt= Instant.now() ;
|
||||
|
||||
@JsonIgnore
|
||||
@LastModifiedDate
|
||||
// @Column(nullable = false)
|
||||
private Instant updatedAt=Instant.now();
|
||||
|
||||
public Instant getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public void setCreatedAt(Instant createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
public Instant getUpdatedAt() {
|
||||
return updatedAt;
|
||||
}
|
||||
|
||||
public void setUpdatedAt(Instant updatedAt) {
|
||||
this.updatedAt = updatedAt;
|
||||
}
|
||||
}
|
||||
37
src/main/java/io/gmss/fiscad/entities/audit/UserDateAudit.java
Executable file
37
src/main/java/io/gmss/fiscad/entities/audit/UserDateAudit.java
Executable file
@@ -0,0 +1,37 @@
|
||||
package io.gmss.fiscad.entities.audit;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.MappedSuperclass;
|
||||
import org.springframework.data.annotation.CreatedBy;
|
||||
import org.springframework.data.annotation.LastModifiedBy;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@MappedSuperclass
|
||||
public abstract class UserDateAudit extends DateAudit implements Serializable {
|
||||
@JsonIgnore
|
||||
@CreatedBy
|
||||
@Column(updatable = false)
|
||||
private Long createdBy;
|
||||
|
||||
@JsonIgnore
|
||||
@LastModifiedBy
|
||||
private Long updatedBy;
|
||||
|
||||
public Long getCreatedBy() {
|
||||
return createdBy;
|
||||
}
|
||||
|
||||
public void setCreatedBy(Long createdBy) {
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
|
||||
public Long getUpdatedBy() {
|
||||
return updatedBy;
|
||||
}
|
||||
|
||||
public void setUpdatedBy(Long updatedBy) {
|
||||
this.updatedBy = updatedBy;
|
||||
}
|
||||
}
|
||||
@@ -181,16 +181,16 @@ public class Enquete extends BaseEntity implements Serializable {
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateFinExcemption;
|
||||
//
|
||||
// @JsonIgnore
|
||||
// @OneToMany(mappedBy = "enquete")
|
||||
// @JsonManagedReference
|
||||
// private List<EnqueteUniteLogement> enqueteUniteLogements;
|
||||
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "enquete")
|
||||
@JsonManagedReference
|
||||
private List<EnqueteUniteLogement> enqueteUniteLogements;
|
||||
|
||||
@JsonIgnore
|
||||
@JsonManagedReference
|
||||
@OneToMany(mappedBy = "enquete")
|
||||
private List<EnqueteBatiment> enqueteBatiments;
|
||||
// @JsonIgnore
|
||||
// @JsonManagedReference
|
||||
// @OneToMany(mappedBy = "enquete")
|
||||
// private List<EnqueteBatiment> enqueteBatiments;
|
||||
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "enquete")
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
import io.gmss.fiscad.entities.decoupage.Quartier;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.NatureDomaine;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.TypeDomaine;
|
||||
import io.gmss.fiscad.entities.rfu.metier.Batiment;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.*;
|
||||
@@ -38,9 +39,11 @@ public class Parcelle extends BaseEntity implements Serializable {
|
||||
private String altitude;
|
||||
private String situationGeographique;
|
||||
@ColumnDefault("0.0")
|
||||
private float superficie;
|
||||
private Float superficie;
|
||||
@ManyToOne
|
||||
private NatureDomaine natureDomaine;
|
||||
@ManyToOne
|
||||
private TypeDomaine typeDomaine;
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Quartier quartier;
|
||||
@@ -52,7 +55,6 @@ public class Parcelle extends BaseEntity implements Serializable {
|
||||
@ManyToOne
|
||||
private Tpe terminal;
|
||||
private String autreNumeroTitreFoncier;
|
||||
private Long typeDomaineId;
|
||||
private Long numeroProvisoire;
|
||||
private Long blocId;
|
||||
@ColumnDefault("false")
|
||||
@@ -64,6 +66,7 @@ public class Parcelle extends BaseEntity implements Serializable {
|
||||
@ManyToOne
|
||||
private Rue rue ;
|
||||
private String numeroRue ;
|
||||
// private String ncProprietaire ;
|
||||
// @JsonIgnore
|
||||
// @OneToMany(mappedBy = "parcelle")
|
||||
// private List<Batiment> batiments;
|
||||
|
||||
@@ -86,9 +86,9 @@ public class EnqueteBatiment extends BaseEntity implements Serializable {
|
||||
private Long nbreEtage;
|
||||
|
||||
// @JsonIgnore
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JsonBackReference
|
||||
private Enquete enquete;
|
||||
// @ManyToOne(fetch = FetchType.LAZY)
|
||||
// @JsonBackReference
|
||||
// private Enquete enquete;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -63,10 +63,10 @@ public class EnqueteUniteLogement extends BaseEntity implements Serializable {
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateFinExcemption;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JsonBackReference
|
||||
private Enquete enquete;
|
||||
// @JsonIgnore
|
||||
// @ManyToOne(fetch = FetchType.LAZY)
|
||||
// @JsonBackReference
|
||||
// private Enquete enquete;
|
||||
|
||||
|
||||
@ManyToOne
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package io.gmss.fiscad.entities.rfu.metier;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import io.gmss.fiscad.deserializer.LocalDateDeserializer;
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Parcelle;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Tpe;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Exercice;
|
||||
import io.gmss.fiscad.enums.StatutParcelle;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Where(clause = " deleted = false")
|
||||
public class SituationFiscaleParcelle extends BaseEntity implements Serializable {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
@ManyToOne
|
||||
private Parcelle parcelle ;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateDernierPaiement;
|
||||
@ManyToOne
|
||||
private Exercice exercice ;
|
||||
private Long montantDu ;
|
||||
private Long montantPaye ;
|
||||
private Long resteAPayer ;
|
||||
private StatutParcelle etatFiscalParcelle ;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateSync;
|
||||
}
|
||||
@@ -32,10 +32,17 @@ import java.time.LocalDate;
|
||||
// "SET deleted = true " +
|
||||
// "WHERE id = ?")
|
||||
//@Where(clause = " deleted = false")
|
||||
@Table(
|
||||
name = "fonction",
|
||||
uniqueConstraints = {
|
||||
@UniqueConstraint(columnNames = {"code"})
|
||||
}
|
||||
)
|
||||
public class Fonction extends BaseEntity implements Serializable {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
@Column(nullable = false, unique = true)
|
||||
private String code ;
|
||||
private String nom ;
|
||||
|
||||
|
||||
15
src/main/java/io/gmss/fiscad/enums/ParametersType.java
Executable file
15
src/main/java/io/gmss/fiscad/enums/ParametersType.java
Executable file
@@ -0,0 +1,15 @@
|
||||
package io.gmss.fiscad.enums;
|
||||
|
||||
public enum ParametersType {
|
||||
EMAILS_TO,
|
||||
EMAIL_FROM,
|
||||
SMTP_PORT,
|
||||
SMTP_HOST,
|
||||
SMTP_USERNAME,
|
||||
SMTP_PASSWORD,
|
||||
MESSAGE_STATUT,
|
||||
OBJET_RESET_PASSWORD,
|
||||
CORPS_RESET_PASSWORD,
|
||||
OBJET_CREATE_ACCOUNT,
|
||||
CORPS_CREATE_ACCOUNT;
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
package io.gmss.fiscad.enums;
|
||||
|
||||
public enum StatutParcelle {
|
||||
|
||||
NON_ENQUETER,
|
||||
ENQUETER_NON_BATIE,
|
||||
ENQUETER_BATIE
|
||||
ENQUETER_NON_BATIE_AJOUR,
|
||||
ENQUETER_BATIE_AJOUR,
|
||||
ENQUETER_NON_BATIE_NON_AJOUR,
|
||||
ENQUETER_BATIE_NON_AJOUR
|
||||
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ public class EnqueteServiceImpl implements EnqueteService {
|
||||
}
|
||||
}
|
||||
|
||||
Optional<Equipe> optionalEquipe = equipeRepository.findById(enquetePayLoadWeb.getEquipeId());
|
||||
//Optional<Equipe> optionalEquipe = equipeRepository.findById(enquetePayLoadWeb.getEquipeId());
|
||||
|
||||
///enregistrement de la pacelle
|
||||
try {
|
||||
@@ -144,7 +144,7 @@ public class EnqueteServiceImpl implements EnqueteService {
|
||||
enquete.setAutreAdresse(enquetePayLoadWeb.getAutreAdresse());
|
||||
enquete.setAutreNumeroTitreFoncier(enquetePayLoadWeb.getAutreNumeroTitreFoncier());
|
||||
enquete.setNumeroTitreFoncier(enquetePayLoadWeb.getNumeroTitreFoncier());
|
||||
enquete.setEquipe(optionalEquipe.orElse(null));
|
||||
//enquete.setEquipe(optionalEquipe.orElse(null));
|
||||
enquete.setDateDebutExcemption(enquetePayLoadWeb.getDateDebutExemption());
|
||||
enquete.setDateFinExcemption(enquetePayLoadWeb.getDateFinExemption());
|
||||
enquete.setNbreBatiment(enquetePayLoadWeb.getNbreBatiment());
|
||||
@@ -232,7 +232,7 @@ public class EnqueteServiceImpl implements EnqueteService {
|
||||
enquetePayLoadWeb.getParcellePayLoadWeb().setRueId(rueId);
|
||||
}
|
||||
|
||||
Optional<Equipe> optionalEquipe = equipeRepository.findById(enquetePayLoadWeb.getEquipeId());
|
||||
//Optional<Equipe> optionalEquipe = equipeRepository.findById(enquetePayLoadWeb.getEquipeId());
|
||||
|
||||
///enregistrement de la pacelle
|
||||
try {
|
||||
@@ -258,7 +258,7 @@ public class EnqueteServiceImpl implements EnqueteService {
|
||||
enquete.setAutreAdresse(enquetePayLoadWeb.getAutreAdresse());
|
||||
enquete.setAutreNumeroTitreFoncier(enquetePayLoadWeb.getAutreNumeroTitreFoncier());
|
||||
enquete.setNumeroTitreFoncier(enquetePayLoadWeb.getNumeroTitreFoncier());
|
||||
enquete.setEquipe(optionalEquipe.orElse(null));
|
||||
// enquete.setEquipe(optionalEquipe.orElse(null));
|
||||
enquete.setDateDebutExcemption(enquetePayLoadWeb.getDateDebutExemption());
|
||||
enquete.setDateFinExcemption(enquetePayLoadWeb.getDateFinExemption());
|
||||
enquete.setNbreBatiment(enquetePayLoadWeb.getNbreBatiment());
|
||||
@@ -599,13 +599,13 @@ public class EnqueteServiceImpl implements EnqueteService {
|
||||
|
||||
List<CaracteristiqueParcelle> caracteristiqueParcelles = caracteristiqueParcelleRepository.findAllByEnquete_Id(enqueteId);
|
||||
|
||||
List<EnqueteBatiment> enqueteBatiments = enqueteBatimentRepository.findAllByEnquete_Id(enqueteId);
|
||||
//List<EnqueteBatiment> enqueteBatiments = enqueteBatimentRepository.findAllByEnquete_Id(enqueteId);
|
||||
|
||||
List<EnqueteUniteLogement> enqueteUniteLogements = enqueteUniteLogementRepository.findAllByEnquete_Id(enqueteId);
|
||||
// List<EnqueteUniteLogement> enqueteUniteLogements = enqueteUniteLogementRepository.findAllByEnquete_Id(enqueteId);
|
||||
|
||||
ficheEnquetesResponse.setCaracteristiquesParcelles(caracteristiqueParcelles);
|
||||
ficheEnquetesResponse.setEnquetesBatiments(enqueteBatiments);
|
||||
ficheEnquetesResponse.setEnquetesUniteLogements(enqueteUniteLogements);
|
||||
// ficheEnquetesResponse.setEnquetesBatiments(enqueteBatiments);
|
||||
// ficheEnquetesResponse.setEnquetesUniteLogements(enqueteUniteLogements);
|
||||
ficheEnqueteResponse.setEnquete(ficheEnquetesResponse);
|
||||
ficheEnqueteResponse.setActeurConcernes(acteurConcernes);
|
||||
|
||||
|
||||
@@ -117,6 +117,50 @@ public class ParcelleServiceImpl implements ParcelleService {
|
||||
return parcelleRepository.findAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<ParcellePayLoadWeb> getParcelleByIdToDto(Long userId, Long parcelleId) {
|
||||
List<Long> secteurIds = getSecteurIdListForUser(userId);
|
||||
return parcelleRepository.findParcelleToDtoById(secteurIds,parcelleId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ParcellePayLoadWeb> getParcelleListToDto(Long userId) {
|
||||
List<Long> secteurIds = getSecteurIdListForUser(userId);
|
||||
return parcelleRepository.findAllParcelleToDto(secteurIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ParcellePayLoadWeb> getParcelleListPageableToDto(Long userId, Pageable pageable) {
|
||||
List<Long> secteurIds = getSecteurIdListForUser(userId);
|
||||
return parcelleRepository.findAllParcelleToDtoPageable(secteurIds,pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ParcellePayLoadWeb> getParcelleListByQuartierToDto(Long userId, Long quartierId) {
|
||||
List<Long> secteurIds = getSecteurIdListForUser(userId);
|
||||
return parcelleRepository.findAllParcelleByQuartierToDto(quartierId,secteurIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ParcellePayLoadWeb> getParcelleListByQuartierPageableToDto(Long userId, Long quartierId, Pageable pageable) {
|
||||
List<Long> secteurIds = getSecteurIdListForUser(userId);
|
||||
return parcelleRepository.findAllParcelleByQuartierToDtoPageable(quartierId,secteurIds,pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ParcellePayLoadWeb> getParcelleListByRueToDto(Long userId, Long rueId) {
|
||||
List<Long> secteurIds = getSecteurIdListForUser(userId);
|
||||
return parcelleRepository.findAllParcelleByRueToDto(rueId,secteurIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ParcellePayLoadWeb> getParcelleListByRuePageableToDto(Long userId, Long rueId, Pageable pageable) {
|
||||
List<Long> secteurIds = getSecteurIdListForUser(userId);
|
||||
|
||||
return parcelleRepository.findAllParcelleByRueToDtoPageable(rueId,secteurIds,pageable);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<Parcelle> getParcelleById(Long id) {
|
||||
if (parcelleRepository.existsById(id)) {
|
||||
@@ -128,22 +172,23 @@ public class ParcelleServiceImpl implements ParcelleService {
|
||||
|
||||
@Override
|
||||
public Page<ParcelleDataTableResponse> getParcelleDataTableListByUserId(Long userId, Pageable pageable) {
|
||||
|
||||
List<Secteur> secteurs = secteurService.getListSecteurUserId(userId);
|
||||
List<Long> secteurIds = secteurs.stream()
|
||||
.map(Secteur::getId)
|
||||
.toList();
|
||||
List<Long> secteurIds = getSecteurIdListForUser(userId);
|
||||
Page<ParcelleDataTableResponse> parcelleDataTableResponses=parcelleRepository.getParcelleDataTableResponse(secteurIds,pageable);
|
||||
|
||||
return parcelleDataTableResponses ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ParcelleDataTableResponse> getParcelleDataTableListByMultiFiltre(Long userId, FiltreParcellePayLoad filtreParcellePayLoad, Pageable pageable) {
|
||||
private List<Long> getSecteurIdListForUser(Long userId) {
|
||||
List<Secteur> secteurs = secteurService.getListSecteurUserId(userId);
|
||||
List<Long> secteurIds = secteurs.stream()
|
||||
.map(Secteur::getId)
|
||||
.toList();
|
||||
return secteurIds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ParcelleDataTableResponse> getParcelleDataTableListByMultiFiltre(Long userId, FiltreParcellePayLoad filtreParcellePayLoad, Pageable pageable) {
|
||||
List<Long> secteurIds = getSecteurIdListForUser(userId);
|
||||
//
|
||||
// return parcelleRepository.findAll(
|
||||
// ParcelleSpecification.filtre(filtreParcellePayLoad, secteurIds),
|
||||
|
||||
@@ -42,24 +42,24 @@ public class EnqueteBatimentServiceImpl implements EnqueteBatimentService {
|
||||
public EnqueteBatiment createEnqueteBatiment(EnqueteBatimentPayloadWeb enqueteBatimentPayloadWeb) throws BadRequestException {
|
||||
EnqueteBatiment enqueteBatiment=new EnqueteBatiment();
|
||||
Batiment batiment=new Batiment();
|
||||
Enquete enquete=new Enquete();
|
||||
//Enquete enquete=new Enquete();
|
||||
if(enqueteBatimentPayloadWeb.getBatimentPaylaodWeb().getId()==null){
|
||||
batiment= batimentService.createBatiment(enqueteBatimentPayloadWeb.getBatimentPaylaodWeb());//entityFromPayLoadService.getBatimentFromPayLoadWeb(enqueteBatimentPayloadWeb.getBatimentPaylaodWeb()));
|
||||
}else{
|
||||
batiment= batimentService.updateBatiment(enqueteBatimentPayloadWeb.getBatimentPaylaodWeb().getId(),enqueteBatimentPayloadWeb.getBatimentPaylaodWeb());//entityFromPayLoadService.getBatimentFromPayLoadWeb(enqueteBatimentPayloadWeb.getBatimentPaylaodWeb()));
|
||||
}
|
||||
|
||||
if(enqueteBatimentPayloadWeb.getEnqueteId()==null){
|
||||
throw new BadRequestException("Impossible de poursuivre l'enregistrement sans la précision de l'enquête");
|
||||
}
|
||||
// if(enqueteBatimentPayloadWeb.getEnqueteId()==null){
|
||||
// throw new BadRequestException("Impossible de poursuivre l'enregistrement sans la précision de l'enquête");
|
||||
// }
|
||||
Optional<Personne> optionalPersonne=Optional.empty();
|
||||
if(enqueteBatimentPayloadWeb.getPersonneId()!=null){
|
||||
optionalPersonne=personneRepository.findById(enqueteBatimentPayloadWeb.getPersonneId());
|
||||
}
|
||||
|
||||
|
||||
Optional<Enquete> optionalEnquete = enqueteRepository.findById(enqueteBatimentPayloadWeb.getEnqueteId());
|
||||
enqueteBatiment.setEnquete(optionalEnquete.orElse(null));
|
||||
//Optional<Enquete> optionalEnquete = enqueteRepository.findById(enqueteBatimentPayloadWeb.getEnqueteId());
|
||||
//enqueteBatiment.setEnquete(optionalEnquete.orElse(null));
|
||||
enqueteBatiment.setBatiment(batiment);
|
||||
enqueteBatiment.setPersonne(optionalPersonne.orElse(null));
|
||||
enqueteBatiment.setAutreCaracteristiquePhysique(enqueteBatimentPayloadWeb.getAutreCaracteristiquePhysique());
|
||||
@@ -95,7 +95,7 @@ public class EnqueteBatimentServiceImpl implements EnqueteBatimentService {
|
||||
|
||||
EnqueteBatiment finalEnqueteBatiment = enqueteBatiment;
|
||||
enqueteBatimentPayloadWeb.getUploadPayLoadWebs().forEach(uploadPayLoadWeb -> {
|
||||
optionalEnquete.ifPresent(value -> uploadPayLoadWeb.setEnqueteId(value.getId()));
|
||||
//optionalEnquete.ifPresent(value -> uploadPayLoadWeb.setEnqueteId(value.getId()));
|
||||
Upload upload=entityFromPayLoadService.getUploadFromPayLoadWeb(uploadPayLoadWeb);
|
||||
upload.setEnqueteBatiment(finalEnqueteBatiment);
|
||||
uploadRepository.save(upload);
|
||||
@@ -112,10 +112,10 @@ public class EnqueteBatimentServiceImpl implements EnqueteBatimentService {
|
||||
if (!enqueteBatimentRepository.existsById(enqueteBatimentPayloadWeb.getId())) {
|
||||
throw new NotFoundException("Impossible de trouver la nouvelle enquete de batiment spécifiée dans notre base de données.");
|
||||
}
|
||||
if(enqueteBatimentPayloadWeb.getEnqueteId()==null){
|
||||
throw new BadRequestException("Impossible de poursuivre l'enregistrement sans la précision de l'enquête");
|
||||
}
|
||||
Optional<Enquete> optionalEnquete = enqueteRepository.findById(enqueteBatimentPayloadWeb.getEnqueteId());
|
||||
// if(enqueteBatimentPayloadWeb.getEnqueteId()==null){
|
||||
// throw new BadRequestException("Impossible de poursuivre l'enregistrement sans la précision de l'enquête");
|
||||
// }
|
||||
// Optional<Enquete> optionalEnquete = enqueteRepository.findById(enqueteBatimentPayloadWeb.getEnqueteId());
|
||||
|
||||
EnqueteBatiment enqueteBatiment=new EnqueteBatiment();
|
||||
Batiment batiment=new Batiment();
|
||||
@@ -131,7 +131,7 @@ public class EnqueteBatimentServiceImpl implements EnqueteBatimentService {
|
||||
if(enqueteBatimentPayloadWeb.getPersonneId()!=null){
|
||||
optionalPersonne=personneRepository.findById(enqueteBatimentPayloadWeb.getPersonneId());
|
||||
}
|
||||
enqueteBatiment.setEnquete(optionalEnquete.orElse(null));
|
||||
//enqueteBatiment.setEnquete(optionalEnquete.orElse(null));
|
||||
enqueteBatiment.setBatiment(batiment);
|
||||
enqueteBatiment.setPersonne(optionalPersonne.orElse(null));
|
||||
enqueteBatiment.setAutreCaracteristiquePhysique(enqueteBatimentPayloadWeb.getAutreCaracteristiquePhysique());
|
||||
|
||||
@@ -47,9 +47,9 @@ public class EnqueteUniteLogementServiceImpl implements EnqueteUniteLogementServ
|
||||
uniteLogement = uniteLogementService.updateUniteLogement(enqueteUniteLogementPayloadWeb.getUniteLogementPaylaodWeb().getId(),entityFromPayLoadService.getUniteLogementFromPayLoadWeb(enqueteUniteLogementPayloadWeb.getUniteLogementPaylaodWeb()));
|
||||
}
|
||||
|
||||
if(enqueteUniteLogementPayloadWeb.getEnqueteId()==null){
|
||||
throw new BadRequestException("Impossible de poursuivre l'enregistrement sans la précision de l'enquête");
|
||||
}
|
||||
// if(enqueteUniteLogementPayloadWeb.getEnqueteId()==null){
|
||||
// throw new BadRequestException("Impossible de poursuivre l'enregistrement sans la précision de l'enquête");
|
||||
// }
|
||||
|
||||
Optional<Personne> optionalPersonne=Optional.empty();
|
||||
if(enqueteUniteLogementPayloadWeb.getPersonneId()!=null){
|
||||
@@ -57,8 +57,8 @@ public class EnqueteUniteLogementServiceImpl implements EnqueteUniteLogementServ
|
||||
}
|
||||
|
||||
|
||||
Optional<Enquete> optionalEnquete = enqueteRepository.findById(enqueteUniteLogementPayloadWeb.getEnqueteId());
|
||||
enqueteUniteLogement.setEnquete(optionalEnquete.orElse(null));
|
||||
//Optional<Enquete> optionalEnquete = enqueteRepository.findById(enqueteUniteLogementPayloadWeb.getEnqueteId());
|
||||
// enqueteUniteLogement.setEnquete(optionalEnquete.orElse(null));
|
||||
enqueteUniteLogement.setUniteLogement(uniteLogement);
|
||||
enqueteUniteLogement.setPersonne(optionalPersonne.orElse(null));
|
||||
enqueteUniteLogement.setEnLocation(enqueteUniteLogementPayloadWeb.isEnLocation());
|
||||
@@ -90,7 +90,7 @@ public class EnqueteUniteLogementServiceImpl implements EnqueteUniteLogementServ
|
||||
///////Enregistrement des pieces
|
||||
EnqueteUniteLogement finalEnqueteUniteLogement = enqueteUniteLogement;
|
||||
enqueteUniteLogementPayloadWeb.getUploadPayLoadWebs().forEach(uploadPayLoadWeb -> {
|
||||
optionalEnquete.ifPresent(value -> uploadPayLoadWeb.setEnqueteId(value.getId()));
|
||||
//optionalEnquete.ifPresent(value -> uploadPayLoadWeb.setEnqueteId(value.getId()));
|
||||
Upload upload=entityFromPayLoadService.getUploadFromPayLoadWeb(uploadPayLoadWeb);
|
||||
upload.setEnqueteUniteLogement(finalEnqueteUniteLogement);
|
||||
uploadRepository.save(upload);
|
||||
@@ -117,17 +117,17 @@ public class EnqueteUniteLogementServiceImpl implements EnqueteUniteLogementServ
|
||||
uniteLogement = uniteLogementService.updateUniteLogement(enqueteUniteLogementPayloadWeb.getUniteLogementPaylaodWeb().getId(),entityFromPayLoadService.getUniteLogementFromPayLoadWeb(enqueteUniteLogementPayloadWeb.getUniteLogementPaylaodWeb()));
|
||||
}
|
||||
|
||||
if(enqueteUniteLogementPayloadWeb.getEnqueteId()==null){
|
||||
throw new BadRequestException("Impossible de poursuivre l'enregistrement sans la précision de l'enquête");
|
||||
}
|
||||
// if(enqueteUniteLogementPayloadWeb.getEnqueteId()==null){
|
||||
// throw new BadRequestException("Impossible de poursuivre l'enregistrement sans la précision de l'enquête");
|
||||
// }
|
||||
|
||||
Optional<Personne> optionalPersonne=Optional.empty();
|
||||
if(enqueteUniteLogementPayloadWeb.getPersonneId()!=null){
|
||||
optionalPersonne=personneRepository.findById(enqueteUniteLogementPayloadWeb.getPersonneId());
|
||||
}
|
||||
Optional<Enquete> optionalEnquete = enqueteRepository.findById(enqueteUniteLogementPayloadWeb.getEnqueteId());
|
||||
// Optional<Enquete> optionalEnquete = enqueteRepository.findById(enqueteUniteLogementPayloadWeb.getEnqueteId());
|
||||
|
||||
enqueteUniteLogement.setEnquete(optionalEnquete.orElse(null));
|
||||
// enqueteUniteLogement.setEnquete(optionalEnquete.orElse(null));
|
||||
enqueteUniteLogement.setUniteLogement(uniteLogement);
|
||||
enqueteUniteLogement.setPersonne(optionalPersonne.orElse(null));
|
||||
enqueteUniteLogement.setEnLocation(enqueteUniteLogementPayloadWeb.isEnLocation());
|
||||
|
||||
@@ -95,7 +95,7 @@ public class DemandeReinitialisationMPServiceImpl implements DemandeReinitialisa
|
||||
if (demandeReinitialisationMPOptional.isPresent()) {
|
||||
DemandeReinitialisationMP demandeReinitialisationMP = demandeReinitialisationMPOptional.get();
|
||||
User user = demandeReinitialisationMP.getUser();
|
||||
userService.resetPassword(user.getUsername(), password);
|
||||
userService.resetPassword(user.getUsername());
|
||||
demandeReinitialisationMP.setEtatDemande(EtatDemande.TRAITE);
|
||||
return demandeReinitialisationMPRepository.save(demandeReinitialisationMP);
|
||||
} else {
|
||||
|
||||
@@ -16,6 +16,8 @@ import io.gmss.fiscad.paylaods.request.crudweb.UserPaylaodWeb;
|
||||
import io.gmss.fiscad.persistence.repositories.user.UserRepository;
|
||||
import io.gmss.fiscad.security.TokenAuthentificationProvider;
|
||||
import io.gmss.fiscad.service.EntityFromPayLoadService;
|
||||
import io.gmss.fiscad.service.MailService;
|
||||
import io.gmss.fiscad.service.StringService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@@ -40,6 +42,8 @@ public class UserServiceImpl implements UserService {
|
||||
private final TokenAuthentificationProvider tokenAuthentificationProvider;
|
||||
private final StructureService structureService;
|
||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
||||
private final StringService stringService ;
|
||||
private final MailService mailService ;
|
||||
|
||||
|
||||
|
||||
@@ -195,26 +199,32 @@ public class UserServiceImpl implements UserService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public User activateOrNotUser(Long id) {
|
||||
public User activateUser(Long id) {
|
||||
User user = getUserById(id);
|
||||
if (user.isActive()) {
|
||||
user.setActive(false);
|
||||
}
|
||||
|
||||
if (!user.isActive()) {
|
||||
user.setActive(true);
|
||||
}
|
||||
return userRepository.save(user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserPaylaodWeb resetPassword(String username, String password) {
|
||||
public User disactivateUser(Long id) {
|
||||
User user = getUserById(id);
|
||||
|
||||
user.setActive(false);
|
||||
|
||||
|
||||
return userRepository.save(user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserPaylaodWeb resetPassword(String username) {
|
||||
User user = userRepository.findByUsername(username).orElseThrow(() -> new NotFoundException(
|
||||
String.format("L'utilisateur %s n'existe pas.", username)
|
||||
));
|
||||
String password = stringService.generatePassword();
|
||||
user.setPassword(passwordEncoder.encode(password));
|
||||
user.setResetPassword(true);
|
||||
user= userRepository.save(user);
|
||||
mailService.sendAccountReinitMail(user,password);
|
||||
Optional<UserPaylaodWeb> optionalUserPaylaodWeb = userRepository.findUserToDtoById(user.getId());
|
||||
return optionalUserPaylaodWeb.orElse(null);
|
||||
}
|
||||
|
||||
15
src/main/java/io/gmss/fiscad/interfaces/ParametersRepository.java
Executable file
15
src/main/java/io/gmss/fiscad/interfaces/ParametersRepository.java
Executable file
@@ -0,0 +1,15 @@
|
||||
package io.gmss.fiscad.interfaces;
|
||||
|
||||
|
||||
import io.gmss.fiscad.entities.Parameters;
|
||||
import io.gmss.fiscad.enums.ParametersType;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface ParametersRepository extends JpaRepository<Parameters, Long> {
|
||||
Optional<Parameters> findFirstByName(ParametersType param);
|
||||
Optional<Parameters> findTopByName(ParametersType param);
|
||||
List<Parameters> findAllByName(ParametersType param);
|
||||
}
|
||||
@@ -21,12 +21,20 @@ public interface ParcelleService {
|
||||
Parcelle updateParcelle(Long id,ParcellePayLoadWeb parcellePayLoadWeb) throws NotFoundException;
|
||||
|
||||
void deleteParcelle(Long id) throws NotFoundException;
|
||||
|
||||
Page<Parcelle> getParcelleList(Pageable pageable);
|
||||
|
||||
List<Parcelle> getParcelleList();
|
||||
|
||||
Optional<Parcelle> getParcelleById(Long id);
|
||||
Page<Parcelle> getParcelleList(Pageable pageable);
|
||||
List<Parcelle> getParcelleList();
|
||||
Optional<ParcellePayLoadWeb> getParcelleByIdToDto(Long UserId,Long parcelleId);
|
||||
List<ParcellePayLoadWeb> getParcelleListToDto(Long userId);
|
||||
Page<ParcellePayLoadWeb> getParcelleListPageableToDto(Long userId,Pageable pageable);
|
||||
List<ParcellePayLoadWeb> getParcelleListByQuartierToDto(Long userId,Long quartierId);
|
||||
Page<ParcellePayLoadWeb> getParcelleListByQuartierPageableToDto(Long userId,Long quartierId,Pageable pageable);
|
||||
|
||||
List<ParcellePayLoadWeb> getParcelleListByRueToDto(Long userId,Long rueId);
|
||||
Page<ParcellePayLoadWeb> getParcelleListByRuePageableToDto(Long userId,Long rueId,Pageable pageable);
|
||||
|
||||
|
||||
|
||||
|
||||
Page<ParcelleDataTableResponse> getParcelleDataTableListByUserId(Long userId, Pageable pageable);
|
||||
Page<ParcelleDataTableResponse> getParcelleDataTableListByMultiFiltre(Long userId, FiltreParcellePayLoad filtreParcellePayLoad, Pageable pageable);
|
||||
|
||||
@@ -43,9 +43,9 @@ public interface UserService {
|
||||
User getUserByUsername(String username);
|
||||
|
||||
|
||||
User activateOrNotUser(Long id);
|
||||
|
||||
UserPaylaodWeb resetPassword(String username, String password);
|
||||
User activateUser(Long id);
|
||||
User disactivateUser(Long id);
|
||||
UserPaylaodWeb resetPassword(String username);
|
||||
|
||||
|
||||
User validateUserAccount(String username);
|
||||
|
||||
@@ -13,10 +13,10 @@ import java.time.LocalDate;
|
||||
@Data
|
||||
public class AvoirFonctionPaylaodWeb {
|
||||
private Long id;
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateDebut;
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateFin;
|
||||
private Long fonctionId;
|
||||
@@ -27,7 +27,7 @@ public class AvoirFonctionPaylaodWeb {
|
||||
private String userNom ;
|
||||
private String userPrenom ;
|
||||
private String email ;
|
||||
//@Enumerated(EnumType.STRING)
|
||||
@Enumerated(EnumType.STRING)
|
||||
private Titre titre;
|
||||
|
||||
public AvoirFonctionPaylaodWeb(
|
||||
|
||||
@@ -28,14 +28,55 @@ public class EnqueteBatimentPayloadWeb {
|
||||
private Long montantMensuelLocation;
|
||||
private Long montantLocatifAnnuelDeclare;
|
||||
private Long nbreEtage;
|
||||
|
||||
private Long valeurBatimentEstime;
|
||||
private Long valeurBatimentReel;
|
||||
private int nbreMoisLocation;
|
||||
private String autreCaracteristiquePhysique;
|
||||
private LocalDate dateDebutExcemption;
|
||||
private LocalDate dateFinExcemption;
|
||||
private Long enqueteId;
|
||||
// private Long enqueteId;
|
||||
private Long batimentId;
|
||||
private Long batimentNub;
|
||||
private Long personneId;
|
||||
private Long EnqueteurId;
|
||||
private String personneNom;
|
||||
private String personnePrenom;
|
||||
private String personneRaisonSociale;
|
||||
private Long enqueteurId;
|
||||
private String enqueteurNom;
|
||||
private String enqueteurPrenom;
|
||||
|
||||
public EnqueteBatimentPayloadWeb(Long id, String observation, float surfaceAuSol, String autreMenuisierie, String autreMur, boolean sbee, String numCompteurSbee, boolean soneb, String numCompteurSoneb, int nbreLotUnite, int nbreUniteLocation, float surfaceLouee, int nbreMenage, int nbreHabitant, Long montantMensuelLocation, Long montantLocatifAnnuelDeclare, Long nbreEtage, Long valeurBatimentEstime, Long valeurBatimentReel, int nbreMoisLocation, String autreCaracteristiquePhysique, LocalDate dateDebutExcemption, LocalDate dateFinExcemption, Long batimentId, Long batimentNub, Long personneId, String personneNom, String personnePrenom, String personneRaisonSociale, Long enqueteurId, String enqueteurNom, String enqueteurPrenom) {
|
||||
this.id = id;
|
||||
this.observation = observation;
|
||||
this.surfaceAuSol = surfaceAuSol;
|
||||
this.autreMenuisierie = autreMenuisierie;
|
||||
this.autreMur = autreMur;
|
||||
this.sbee = sbee;
|
||||
this.numCompteurSbee = numCompteurSbee;
|
||||
this.soneb = soneb;
|
||||
this.numCompteurSoneb = numCompteurSoneb;
|
||||
this.nbreLotUnite = nbreLotUnite;
|
||||
this.nbreUniteLocation = nbreUniteLocation;
|
||||
this.surfaceLouee = surfaceLouee;
|
||||
this.nbreMenage = nbreMenage;
|
||||
this.nbreHabitant = nbreHabitant;
|
||||
this.montantMensuelLocation = montantMensuelLocation;
|
||||
this.montantLocatifAnnuelDeclare = montantLocatifAnnuelDeclare;
|
||||
this.nbreEtage = nbreEtage;
|
||||
this.valeurBatimentEstime = valeurBatimentEstime;
|
||||
this.valeurBatimentReel = valeurBatimentReel;
|
||||
this.nbreMoisLocation = nbreMoisLocation;
|
||||
this.autreCaracteristiquePhysique = autreCaracteristiquePhysique;
|
||||
this.dateDebutExcemption = dateDebutExcemption;
|
||||
this.dateFinExcemption = dateFinExcemption;
|
||||
this.batimentId = batimentId;
|
||||
this.batimentNub = batimentNub;
|
||||
this.personneId = personneId;
|
||||
this.personneNom = personneNom;
|
||||
this.personnePrenom = personnePrenom;
|
||||
this.personneRaisonSociale = personneRaisonSociale;
|
||||
this.enqueteurId = enqueteurId;
|
||||
this.enqueteurNom = enqueteurNom;
|
||||
this.enqueteurPrenom = enqueteurPrenom;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,12 +37,72 @@ public class EnquetePayLoadWeb {
|
||||
private LocalDate dateDebutExemption;
|
||||
private LocalDate dateFinExemption;
|
||||
private String autreNumeroTitreFoncier;
|
||||
private Long EquipeId;
|
||||
private Long zoneRfuId;
|
||||
private Long proprietaireId;
|
||||
private Long EnqueteurId;
|
||||
private Long montantMensuelleLocation;
|
||||
private Long montantAnnuelleLocation;
|
||||
private Long valeurParcelleEstime;
|
||||
private Long valeurParcelleReel;
|
||||
// private Long equipeId;
|
||||
private Long zoneRfuId;
|
||||
private String zoneRfuNom;
|
||||
private Long proprietaireId;
|
||||
private String proprietaireNom;
|
||||
private String proprietairePrenom;
|
||||
private String proprietaireRaisonSociale;
|
||||
private Long enqueteurId;
|
||||
private String enqueteurNom;
|
||||
private String enqueteurPrenom;
|
||||
private Long secteurId;
|
||||
private String secteurCode;
|
||||
private String secteurNom;
|
||||
private Long parcelleId;
|
||||
private String parcelleNup;
|
||||
private String parcelleQ;
|
||||
private String parcelleI;
|
||||
private String parcelleP;
|
||||
|
||||
public EnquetePayLoadWeb(Long id, LocalDate dateEnquete, LocalDate dateFinalisation, boolean litige, StatutEnquete statutEnquete, String descriptionMotifRejet, String observation, String numeroTitreFoncier, LocalDate dateTitreFoncier, String numEntreeParcelle, String numRue, String nomRue, float precision, int nbreCoProprietaire, int nbreIndivisiaire, String autreAdresse, float superficie, int nbreBatiment, int nbrePiscine, LocalDate dateDebutExemption, LocalDate dateFinExemption, String autreNumeroTitreFoncier, Long montantMensuelleLocation, Long montantAnnuelleLocation, Long valeurParcelleEstime, Long valeurParcelleReel, Long zoneRfuId, String zoneRfuNom, Long proprietaireId, String proprietaireNom, String proprietairePrenom, String proprietaireRaisonSociale, Long enqueteurId, String enqueteurNom, String enqueteurPrenom, Long secteurId, String secteurCode, String secteurNom
|
||||
,Long parcelleId,String parcelleNup,String parcelleQ,String parcelleI,String parcelleP) {
|
||||
this.id = id;
|
||||
this.dateEnquete = dateEnquete;
|
||||
this.dateFinalisation = dateFinalisation;
|
||||
this.litige = litige;
|
||||
this.statutEnquete = statutEnquete;
|
||||
this.descriptionMotifRejet = descriptionMotifRejet;
|
||||
this.observation = observation;
|
||||
this.numeroTitreFoncier = numeroTitreFoncier;
|
||||
this.dateTitreFoncier = dateTitreFoncier;
|
||||
this.numEntreeParcelle = numEntreeParcelle;
|
||||
this.numRue = numRue;
|
||||
this.nomRue = nomRue;
|
||||
this.precision = precision;
|
||||
this.nbreCoProprietaire = nbreCoProprietaire;
|
||||
this.nbreIndivisiaire = nbreIndivisiaire;
|
||||
this.autreAdresse = autreAdresse;
|
||||
this.superficie = superficie;
|
||||
this.nbreBatiment = nbreBatiment;
|
||||
this.nbrePiscine = nbrePiscine;
|
||||
this.dateDebutExemption = dateDebutExemption;
|
||||
this.dateFinExemption = dateFinExemption;
|
||||
this.autreNumeroTitreFoncier = autreNumeroTitreFoncier;
|
||||
this.montantMensuelleLocation = montantMensuelleLocation;
|
||||
this.montantAnnuelleLocation = montantAnnuelleLocation;
|
||||
this.valeurParcelleEstime = valeurParcelleEstime;
|
||||
this.valeurParcelleReel = valeurParcelleReel;
|
||||
this.zoneRfuId = zoneRfuId;
|
||||
this.zoneRfuNom = zoneRfuNom;
|
||||
this.proprietaireId = proprietaireId;
|
||||
this.proprietaireNom = proprietaireNom;
|
||||
this.proprietairePrenom = proprietairePrenom;
|
||||
this.proprietaireRaisonSociale = proprietaireRaisonSociale;
|
||||
this.enqueteurId = enqueteurId;
|
||||
this.enqueteurNom = enqueteurNom;
|
||||
this.enqueteurPrenom = enqueteurPrenom;
|
||||
this.secteurId = secteurId;
|
||||
this.secteurCode = secteurCode;
|
||||
this.parcelleId = parcelleId;
|
||||
this.parcelleNup = parcelleNup;
|
||||
this.parcelleQ = parcelleQ;
|
||||
this.parcelleI = parcelleI;
|
||||
this.parcelleP = parcelleP;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,8 +31,49 @@ public class EnqueteUniteLogementPayloadWeb {
|
||||
private String numCompteurSoneb;
|
||||
private LocalDate dateDebutExcemption;
|
||||
private LocalDate dateFinExcemption;
|
||||
private Long enqueteId;
|
||||
//private Long enqueteId;
|
||||
private Long uniteLogementId;
|
||||
private String uniteLogementNumeroEtage;
|
||||
private String uniteLogementNul;
|
||||
private Long personneId;
|
||||
private String personneNom;
|
||||
private String personnePrenom;
|
||||
private String personneRaisonSociale;
|
||||
private Long enqueteurId;
|
||||
private String enqueteurNom;
|
||||
private String enqueteurPrenom;
|
||||
|
||||
public EnqueteUniteLogementPayloadWeb(Long id, String observation, Long userId, float surface, int nbrePiece, int nbreHabitant, int nbreMenage, boolean enLocation, int nbreMoisLocation, Long montantMensuelLoyer, Long montantLocatifAnnuelDeclare, Long valeurUniteLogementEstime, Long valeurUniteLogementReel, float surfaceAuSol, float surfaceLouee, boolean sbee, boolean soneb, String numCompteurSbee, String numCompteurSoneb, LocalDate dateDebutExcemption, LocalDate dateFinExcemption, Long uniteLogementId, String uniteLogementNumeroEtage, String uniteLogementNul, Long personneId, String personneNom, String personnePrenom, String personneRaisonSociale, Long enqueteurId, String enqueteurNom, String enqueteurPrenom) {
|
||||
this.id = id;
|
||||
this.observation = observation;
|
||||
this.userId = userId;
|
||||
this.surface = surface;
|
||||
this.nbrePiece = nbrePiece;
|
||||
this.nbreHabitant = nbreHabitant;
|
||||
this.nbreMenage = nbreMenage;
|
||||
this.enLocation = enLocation;
|
||||
this.nbreMoisLocation = nbreMoisLocation;
|
||||
this.montantMensuelLoyer = montantMensuelLoyer;
|
||||
this.montantLocatifAnnuelDeclare = montantLocatifAnnuelDeclare;
|
||||
this.valeurUniteLogementEstime = valeurUniteLogementEstime;
|
||||
this.valeurUniteLogementReel = valeurUniteLogementReel;
|
||||
SurfaceAuSol = surfaceAuSol;
|
||||
this.surfaceLouee = surfaceLouee;
|
||||
this.sbee = sbee;
|
||||
this.soneb = soneb;
|
||||
this.numCompteurSbee = numCompteurSbee;
|
||||
this.numCompteurSoneb = numCompteurSoneb;
|
||||
this.dateDebutExcemption = dateDebutExcemption;
|
||||
this.dateFinExcemption = dateFinExcemption;
|
||||
this.uniteLogementId = uniteLogementId;
|
||||
this.uniteLogementNumeroEtage = uniteLogementNumeroEtage;
|
||||
this.uniteLogementNul = uniteLogementNul;
|
||||
this.personneId = personneId;
|
||||
this.personneNom = personneNom;
|
||||
this.personnePrenom = personnePrenom;
|
||||
this.personneRaisonSociale = personneRaisonSociale;
|
||||
this.enqueteurId = enqueteurId;
|
||||
this.enqueteurNom = enqueteurNom;
|
||||
this.enqueteurPrenom = enqueteurPrenom;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,14 +14,85 @@ public class ParcellePayLoadWeb {
|
||||
private String longitude;
|
||||
private String latitude;
|
||||
private String altitude;
|
||||
private String emplacement;
|
||||
private Long situationGeographiqueId;
|
||||
private Long natureDomaineId;
|
||||
private Long quartierId;
|
||||
private Float superficie;
|
||||
private String observation;
|
||||
private Long typeDomaineId;
|
||||
private String situationGeographique;
|
||||
private Long rueId;
|
||||
private String numEntreeParcelle;
|
||||
private Long quartierId;
|
||||
private String quartierCode;
|
||||
private String quartierNom;
|
||||
private Long natureDomaineId;
|
||||
private String natureDomaineLibelle;
|
||||
private Long typeDomaineId;
|
||||
private String typeDomaineLibelle;
|
||||
private Long rueId;
|
||||
private String rueNumero;
|
||||
private String rueNom;
|
||||
private Long proprietaireId;
|
||||
private String proprietaireIfu;
|
||||
private String proprietaireNpi;
|
||||
private String proprietaireNom;
|
||||
private String proprietairePrenom;
|
||||
private String proprietaireRaisonSociale;
|
||||
|
||||
|
||||
public ParcellePayLoadWeb(Long id, String q, String i, String p, String nup, String nupProvisoire, String numTitreFoncier, String longitude, String latitude, String altitude, Float superficie, String observation, String situationGeographique, String numEntreeParcelle, Long quartierId, String quartierCode, String quartierNom, Long natureDomaineId, String natureDomaineLibelle, Long typeDomaineId, String typeDomaineLibelle, Long rueId, String rueNumero, String rueNom) {
|
||||
this.id = id;
|
||||
this.q = q;
|
||||
this.i = i;
|
||||
this.p = p;
|
||||
this.nup = nup;
|
||||
this.nupProvisoire = nupProvisoire;
|
||||
this.numTitreFoncier = numTitreFoncier;
|
||||
this.longitude = longitude;
|
||||
this.latitude = latitude;
|
||||
this.altitude = altitude;
|
||||
this.superficie = superficie;
|
||||
this.observation = observation;
|
||||
this.situationGeographique = situationGeographique;
|
||||
this.numEntreeParcelle = numEntreeParcelle;
|
||||
this.quartierId = quartierId;
|
||||
this.quartierCode = quartierCode;
|
||||
this.quartierNom = quartierNom;
|
||||
this.natureDomaineId = natureDomaineId;
|
||||
this.natureDomaineLibelle = natureDomaineLibelle;
|
||||
this.typeDomaineId = typeDomaineId;
|
||||
this.typeDomaineLibelle = typeDomaineLibelle;
|
||||
this.rueId = rueId;
|
||||
this.rueNumero = rueNumero;
|
||||
this.rueNom = rueNom;
|
||||
}
|
||||
|
||||
public ParcellePayLoadWeb(Long id, String q, String i, String p, String nup, String nupProvisoire, String numTitreFoncier, String longitude, String latitude, String altitude, Float superficie, String observation, String situationGeographique, String numEntreeParcelle, Long quartierId, String quartierCode, String quartierNom, Long natureDomaineId, String natureDomaineLibelle, Long typeDomaineId, String typeDomaineLibelle, Long rueId, String rueNumero, String rueNom, Long proprietaireId, String proprietaireIfu, String proprietaireNpi, String proprietaireNom, String proprietairePrenom, String proprietaireRaisonSociale) {
|
||||
this.id = id;
|
||||
this.q = q;
|
||||
this.i = i;
|
||||
this.p = p;
|
||||
this.nup = nup;
|
||||
this.nupProvisoire = nupProvisoire;
|
||||
this.numTitreFoncier = numTitreFoncier;
|
||||
this.longitude = longitude;
|
||||
this.latitude = latitude;
|
||||
this.altitude = altitude;
|
||||
this.superficie = superficie;
|
||||
this.observation = observation;
|
||||
this.situationGeographique = situationGeographique;
|
||||
this.numEntreeParcelle = numEntreeParcelle;
|
||||
this.quartierId = quartierId;
|
||||
this.quartierCode = quartierCode;
|
||||
this.quartierNom = quartierNom;
|
||||
this.natureDomaineId = natureDomaineId;
|
||||
this.natureDomaineLibelle = natureDomaineLibelle;
|
||||
this.typeDomaineId = typeDomaineId;
|
||||
this.typeDomaineLibelle = typeDomaineLibelle;
|
||||
this.rueId = rueId;
|
||||
this.rueNumero = rueNumero;
|
||||
this.rueNom = rueNom;
|
||||
this.proprietaireId = proprietaireId;
|
||||
this.proprietaireIfu = proprietaireIfu;
|
||||
this.proprietaireNpi = proprietaireNpi;
|
||||
this.proprietaireNom = proprietaireNom;
|
||||
this.proprietairePrenom = proprietairePrenom;
|
||||
this.proprietaireRaisonSociale = proprietaireRaisonSociale;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ public class UniteLogementPaylaodWeb {
|
||||
private String numeroEtage;
|
||||
private String code;
|
||||
private Long batimentId;
|
||||
private String batimentNub;
|
||||
private String observation;
|
||||
private LocalDate dateConstruction;
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ public class UserPaylaodWeb {
|
||||
private Long structureId;
|
||||
private String structureCode;
|
||||
private String structureNom;
|
||||
private Boolean actif;
|
||||
private Boolean resetPassword;
|
||||
|
||||
public UserPaylaodWeb(Long id,
|
||||
String nom,
|
||||
@@ -29,7 +31,9 @@ public class UserPaylaodWeb {
|
||||
String email,
|
||||
Long structureId,
|
||||
String structureCode,
|
||||
String structureNom) {
|
||||
String structureNom,
|
||||
Boolean actif,
|
||||
Boolean resetPassword) {
|
||||
this.id = id;
|
||||
this.nom = nom;
|
||||
this.prenom = prenom;
|
||||
@@ -39,5 +43,7 @@ public class UserPaylaodWeb {
|
||||
this.structureId = structureId;
|
||||
this.structureCode = structureCode;
|
||||
this.structureNom = structureNom;
|
||||
this.actif = actif;
|
||||
this.resetPassword = resetPassword;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package io.gmss.fiscad.persistence.repositories.infocad.metier;
|
||||
|
||||
import io.gmss.fiscad.entities.infocad.metier.Parcelle;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.ParcellePayLoadWeb;
|
||||
import io.gmss.fiscad.paylaods.response.dataTableResponse.ParcelleDataTableResponse;
|
||||
import io.gmss.fiscad.paylaods.response.statistique.StatistiqueTypeNombreResponse;
|
||||
import io.gmss.fiscad.paylaods.response.restoration.ParcellePayLoadRestor;
|
||||
@@ -164,5 +165,408 @@ public interface ParcelleRepository extends JpaRepository<Parcelle, Long>, JpaSp
|
||||
Pageable pageable
|
||||
);
|
||||
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.ParcellePayLoadWeb(
|
||||
p.id,
|
||||
p.q,
|
||||
p.i,
|
||||
p.p,
|
||||
p.nup,
|
||||
p.nupProvisoire,
|
||||
p.numTitreFoncier,
|
||||
p.longitude,
|
||||
p.latitude,
|
||||
p.altitude,
|
||||
p.superficie,
|
||||
p.observation,
|
||||
p.situationGeographique,
|
||||
p.numEntreeParcelle,
|
||||
q.id,
|
||||
q.code,
|
||||
q.nom,
|
||||
nd.id,
|
||||
nd.libelle,
|
||||
td.id,
|
||||
td.libelle,
|
||||
r.id,
|
||||
r.numero,
|
||||
r.nom,
|
||||
pers.id,
|
||||
pers.ifu,
|
||||
pers.npi,
|
||||
pers.nom,
|
||||
pers.prenom,
|
||||
pers.raisonSociale
|
||||
)
|
||||
FROM Parcelle p
|
||||
LEFT JOIN p.quartier q
|
||||
LEFT JOIN p.natureDomaine nd
|
||||
LEFT JOIN p.typeDomaine td
|
||||
LEFT JOIN p.rue r
|
||||
LEFT JOIN Enquete e
|
||||
ON e.parcelle = p
|
||||
AND e.dateEnquete = (
|
||||
SELECT MAX(e2.dateEnquete)
|
||||
FROM Enquete e2
|
||||
WHERE e2.parcelle = p
|
||||
)
|
||||
LEFT JOIN e.personne pers
|
||||
INNER JOIN SecteurDecoupage sd on sd.quartier=p.quartier
|
||||
WHERE sd.secteur.id IN (:secteurIds)
|
||||
""")
|
||||
List<ParcellePayLoadWeb> findAllParcelleToDto(@Param("secteurIds") List<Long> secteurIds);
|
||||
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.ParcellePayLoadWeb(
|
||||
p.id,
|
||||
p.q,
|
||||
p.i,
|
||||
p.p,
|
||||
p.nup,
|
||||
p.nupProvisoire,
|
||||
p.numTitreFoncier,
|
||||
p.longitude,
|
||||
p.latitude,
|
||||
p.altitude,
|
||||
p.superficie,
|
||||
p.observation,
|
||||
p.situationGeographique,
|
||||
p.numEntreeParcelle,
|
||||
q.id,
|
||||
q.code,
|
||||
q.nom,
|
||||
nd.id,
|
||||
nd.libelle,
|
||||
td.id,
|
||||
td.libelle,
|
||||
r.id,
|
||||
r.numero,
|
||||
r.nom,
|
||||
pers.id,
|
||||
pers.ifu,
|
||||
pers.npi,
|
||||
pers.nom,
|
||||
pers.prenom,
|
||||
pers.raisonSociale
|
||||
)
|
||||
FROM Parcelle p
|
||||
LEFT JOIN p.quartier q
|
||||
LEFT JOIN p.natureDomaine nd
|
||||
LEFT JOIN p.typeDomaine td
|
||||
LEFT JOIN p.rue r
|
||||
LEFT JOIN Enquete e
|
||||
ON e.parcelle = p
|
||||
AND e.dateEnquete = (
|
||||
SELECT MAX(e2.dateEnquete)
|
||||
FROM Enquete e2
|
||||
WHERE e2.parcelle = p
|
||||
)
|
||||
LEFT JOIN e.personne pers
|
||||
INNER JOIN SecteurDecoupage sd on sd.quartier=p.quartier
|
||||
WHERE sd.secteur.id IN (:secteurIds) and p.id = :parcelleId
|
||||
""")
|
||||
Optional<ParcellePayLoadWeb> findParcelleToDtoById(
|
||||
@Param("secteurIds") List<Long> secteurIds,
|
||||
@Param("parcelleId") Long parcelleId
|
||||
);
|
||||
|
||||
|
||||
@Query(
|
||||
value = """
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.ParcellePayLoadWeb(
|
||||
p.id,
|
||||
p.q,
|
||||
p.i,
|
||||
p.p,
|
||||
p.nup,
|
||||
p.nupProvisoire,
|
||||
p.numTitreFoncier,
|
||||
p.longitude,
|
||||
p.latitude,
|
||||
p.altitude,
|
||||
p.superficie,
|
||||
p.observation,
|
||||
p.situationGeographique,
|
||||
p.numEntreeParcelle,
|
||||
q.id,
|
||||
q.code,
|
||||
q.nom,
|
||||
nd.id,
|
||||
nd.libelle,
|
||||
td.id,
|
||||
td.libelle,
|
||||
r.id,
|
||||
r.numero,
|
||||
r.nom,
|
||||
pers.id,
|
||||
pers.ifu,
|
||||
pers.npi,
|
||||
pers.nom,
|
||||
pers.prenom,
|
||||
pers.raisonSociale
|
||||
)
|
||||
FROM Parcelle p
|
||||
LEFT JOIN p.quartier q
|
||||
LEFT JOIN p.natureDomaine nd
|
||||
LEFT JOIN p.typeDomaine td
|
||||
LEFT JOIN p.rue r
|
||||
LEFT JOIN Enquete e
|
||||
ON e.parcelle = p
|
||||
AND e.dateEnquete = (
|
||||
SELECT MAX(e2.dateEnquete)
|
||||
FROM Enquete e2
|
||||
WHERE e2.parcelle = p
|
||||
)
|
||||
LEFT JOIN e.personne pers
|
||||
INNER JOIN SecteurDecoupage sd on sd.quartier=p.quartier
|
||||
WHERE sd.secteur.id IN (:secteurIds)
|
||||
""",
|
||||
countQuery = """
|
||||
SELECT COUNT(DISTINCT p.id)
|
||||
FROM Parcelle p
|
||||
INNER JOIN SecteurDecoupage sd on sd.quartier=p.quartier
|
||||
WHERE sd.secteur.id IN (:secteurIds)
|
||||
"""
|
||||
)
|
||||
Page<ParcellePayLoadWeb> findAllParcelleToDtoPageable(@Param("secteurIds") List<Long> secteurIds,Pageable pageable);
|
||||
|
||||
|
||||
@Query(
|
||||
"""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.ParcellePayLoadWeb(
|
||||
p.id,
|
||||
p.q,
|
||||
p.i,
|
||||
p.p,
|
||||
p.nup,
|
||||
p.nupProvisoire,
|
||||
p.numTitreFoncier,
|
||||
p.longitude,
|
||||
p.latitude,
|
||||
p.altitude,
|
||||
p.superficie,
|
||||
p.observation,
|
||||
p.situationGeographique,
|
||||
p.numEntreeParcelle,
|
||||
q.id,
|
||||
q.code,
|
||||
q.nom,
|
||||
nd.id,
|
||||
nd.libelle,
|
||||
td.id,
|
||||
td.libelle,
|
||||
r.id,
|
||||
r.numero,
|
||||
r.nom,
|
||||
pers.id,
|
||||
pers.ifu,
|
||||
pers.npi,
|
||||
pers.nom,
|
||||
pers.prenom,
|
||||
pers.raisonSociale
|
||||
)
|
||||
FROM Parcelle p
|
||||
LEFT JOIN p.quartier q
|
||||
LEFT JOIN p.natureDomaine nd
|
||||
LEFT JOIN p.typeDomaine td
|
||||
LEFT JOIN p.rue r
|
||||
LEFT JOIN Enquete e
|
||||
ON e.parcelle = p
|
||||
AND e.dateEnquete = (
|
||||
SELECT MAX(e2.dateEnquete)
|
||||
FROM Enquete e2
|
||||
WHERE e2.parcelle = p
|
||||
)
|
||||
LEFT JOIN e.personne pers
|
||||
INNER JOIN SecteurDecoupage sd on sd.quartier=p.quartier
|
||||
WHERE sd.secteur.id IN (:secteurIds) and q.id = :quartierId
|
||||
"""
|
||||
)
|
||||
List<ParcellePayLoadWeb> findAllParcelleByQuartierToDto(
|
||||
@Param("quartierId") Long quartierId,@Param("secteurIds") List<Long> secteurIds
|
||||
);
|
||||
|
||||
@Query(
|
||||
value = """
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.ParcellePayLoadWeb(
|
||||
p.id,
|
||||
p.q,
|
||||
p.i,
|
||||
p.p,
|
||||
p.nup,
|
||||
p.nupProvisoire,
|
||||
p.numTitreFoncier,
|
||||
p.longitude,
|
||||
p.latitude,
|
||||
p.altitude,
|
||||
p.superficie,
|
||||
p.observation,
|
||||
p.situationGeographique,
|
||||
p.numEntreeParcelle,
|
||||
q.id,
|
||||
q.code,
|
||||
q.nom,
|
||||
nd.id,
|
||||
nd.libelle,
|
||||
td.id,
|
||||
td.libelle,
|
||||
r.id,
|
||||
r.numero,
|
||||
r.nom,
|
||||
pers.id,
|
||||
pers.ifu,
|
||||
pers.npi,
|
||||
pers.nom,
|
||||
pers.prenom,
|
||||
pers.raisonSociale
|
||||
)
|
||||
FROM Parcelle p
|
||||
LEFT JOIN p.quartier q
|
||||
LEFT JOIN p.natureDomaine nd
|
||||
LEFT JOIN p.typeDomaine td
|
||||
LEFT JOIN p.rue r
|
||||
LEFT JOIN Enquete e
|
||||
ON e.parcelle = p
|
||||
AND e.dateEnquete = (
|
||||
SELECT MAX(e2.dateEnquete)
|
||||
FROM Enquete e2
|
||||
WHERE e2.parcelle = p
|
||||
)
|
||||
LEFT JOIN e.personne pers
|
||||
INNER JOIN SecteurDecoupage sd on sd.quartier=p.quartier
|
||||
WHERE sd.secteur.id IN (:secteurIds) and q.id = :quartierId
|
||||
""",
|
||||
countQuery = """
|
||||
SELECT COUNT(DISTINCT p.id)
|
||||
FROM Parcelle p
|
||||
LEFT JOIN p.quartier q
|
||||
INNER JOIN SecteurDecoupage sd on sd.quartier=p.quartier
|
||||
WHERE sd.secteur.id IN (:secteurIds) and q.id = :quartierId
|
||||
"""
|
||||
)
|
||||
Page<ParcellePayLoadWeb> findAllParcelleByQuartierToDtoPageable(
|
||||
@Param("quartierId") Long quartierId,@Param("secteurIds") List<Long> secteurIds,
|
||||
Pageable pageable
|
||||
);
|
||||
|
||||
|
||||
|
||||
@Query(
|
||||
"""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.ParcellePayLoadWeb(
|
||||
p.id,
|
||||
p.q,
|
||||
p.i,
|
||||
p.p,
|
||||
p.nup,
|
||||
p.nupProvisoire,
|
||||
p.numTitreFoncier,
|
||||
p.longitude,
|
||||
p.latitude,
|
||||
p.altitude,
|
||||
p.superficie,
|
||||
p.observation,
|
||||
p.situationGeographique,
|
||||
p.numEntreeParcelle,
|
||||
q.id,
|
||||
q.code,
|
||||
q.nom,
|
||||
nd.id,
|
||||
nd.libelle,
|
||||
td.id,
|
||||
td.libelle,
|
||||
r.id,
|
||||
r.numero,
|
||||
r.nom,
|
||||
pers.id,
|
||||
pers.ifu,
|
||||
pers.npi,
|
||||
pers.nom,
|
||||
pers.prenom,
|
||||
pers.raisonSociale
|
||||
)
|
||||
FROM Parcelle p
|
||||
LEFT JOIN p.quartier q
|
||||
LEFT JOIN p.natureDomaine nd
|
||||
LEFT JOIN p.typeDomaine td
|
||||
LEFT JOIN p.rue r
|
||||
LEFT JOIN Enquete e
|
||||
ON e.parcelle = p
|
||||
AND e.dateEnquete = (
|
||||
SELECT MAX(e2.dateEnquete)
|
||||
FROM Enquete e2
|
||||
WHERE e2.parcelle = p
|
||||
)
|
||||
LEFT JOIN e.personne pers
|
||||
INNER JOIN SecteurDecoupage sd on sd.quartier=p.quartier
|
||||
WHERE sd.secteur.id IN (:secteurIds) and r.id = :rueId
|
||||
"""
|
||||
)
|
||||
List<ParcellePayLoadWeb> findAllParcelleByRueToDto(
|
||||
@Param("rueId") Long rueId,@Param("secteurIds") List<Long> secteurIds
|
||||
);
|
||||
|
||||
@Query(
|
||||
value = """
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.ParcellePayLoadWeb(
|
||||
p.id,
|
||||
p.q,
|
||||
p.i,
|
||||
p.p,
|
||||
p.nup,
|
||||
p.nupProvisoire,
|
||||
p.numTitreFoncier,
|
||||
p.longitude,
|
||||
p.latitude,
|
||||
p.altitude,
|
||||
p.superficie,
|
||||
p.observation,
|
||||
p.situationGeographique,
|
||||
p.numEntreeParcelle,
|
||||
q.id,
|
||||
q.code,
|
||||
q.nom,
|
||||
nd.id,
|
||||
nd.libelle,
|
||||
td.id,
|
||||
td.libelle,
|
||||
r.id,
|
||||
r.numero,
|
||||
r.nom,
|
||||
pers.id,
|
||||
pers.ifu,
|
||||
pers.npi,
|
||||
pers.nom,
|
||||
pers.prenom,
|
||||
pers.raisonSociale
|
||||
)
|
||||
FROM Parcelle p
|
||||
LEFT JOIN p.quartier q
|
||||
LEFT JOIN p.natureDomaine nd
|
||||
LEFT JOIN p.typeDomaine td
|
||||
LEFT JOIN p.rue r
|
||||
LEFT JOIN Enquete e
|
||||
ON e.parcelle = p
|
||||
AND e.dateEnquete = (
|
||||
SELECT MAX(e2.dateEnquete)
|
||||
FROM Enquete e2
|
||||
WHERE e2.parcelle = p
|
||||
)
|
||||
LEFT JOIN e.personne pers
|
||||
INNER JOIN SecteurDecoupage sd on sd.quartier=p.quartier
|
||||
WHERE sd.secteur.id IN (:secteurIds) and r.id = :rueId
|
||||
""",
|
||||
countQuery = """
|
||||
SELECT COUNT(DISTINCT p.id)
|
||||
FROM Parcelle p
|
||||
LEFT JOIN p.rue r
|
||||
INNER JOIN SecteurDecoupage sd on sd.quartier=p.quartier
|
||||
WHERE sd.secteur.id IN (:secteurIds) and r.id = :rueId
|
||||
"""
|
||||
)
|
||||
Page<ParcellePayLoadWeb> findAllParcelleByRueToDtoPageable(
|
||||
@Param("rueId") Long rueId, @Param("secteurIds") List<Long> secteurIds,
|
||||
Pageable pageable
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -14,17 +14,17 @@ import java.util.Optional;
|
||||
|
||||
|
||||
public interface CaracteristiqueBatimentRepository extends JpaRepository<CaracteristiqueBatiment, Long> {
|
||||
@Transactional
|
||||
@Modifying
|
||||
void deleteAllByEnqueteBatiment(EnqueteBatiment enqueteBatiment);
|
||||
// @Transactional
|
||||
// @Modifying
|
||||
// void deleteAllByEnqueteBatiment(EnqueteBatiment enqueteBatiment);
|
||||
Optional<CaracteristiqueBatiment> findByMobileDataId(Long id);
|
||||
@Modifying
|
||||
@Transactional
|
||||
@Query("""
|
||||
DELETE FROM CaracteristiqueBatiment cb
|
||||
WHERE cb.enqueteBatiment.enquete.id = :enqueteId
|
||||
""")
|
||||
void deleteByEnqueteId(@Param("enqueteId") Long enqueteId);
|
||||
// @Modifying
|
||||
// @Transactional
|
||||
// @Query("""
|
||||
// DELETE FROM CaracteristiqueBatiment cb
|
||||
// WHERE cb.enqueteBatiment.enquete.id = :enqueteId
|
||||
// """)
|
||||
// void deleteByEnqueteId(@Param("enqueteId") Long enqueteId);
|
||||
|
||||
|
||||
@Query(
|
||||
|
||||
@@ -14,17 +14,17 @@ import java.util.Optional;
|
||||
|
||||
|
||||
public interface CaracteristiqueUniteLogementRepository extends JpaRepository<CaracteristiqueUniteLogement, Long> {
|
||||
@Modifying
|
||||
@Transactional
|
||||
void deleteAllByEnqueteUniteLogement(EnqueteUniteLogement enqueteUniteLogement);
|
||||
// @Modifying
|
||||
// @Transactional
|
||||
// void deleteAllByEnqueteUniteLogement(EnqueteUniteLogement enqueteUniteLogement);
|
||||
Optional<CaracteristiqueUniteLogement> findByMobileDataId(Long id);
|
||||
@Modifying
|
||||
@Transactional
|
||||
@Query("""
|
||||
DELETE FROM CaracteristiqueUniteLogement ul
|
||||
WHERE ul.enqueteUniteLogement.enquete.id = :enqueteId
|
||||
""")
|
||||
void deleteByEnqueteId(@Param("enqueteId") Long enqueteId);
|
||||
// @Modifying
|
||||
// @Transactional
|
||||
// @Query("""
|
||||
// DELETE FROM CaracteristiqueUniteLogement ul
|
||||
// WHERE ul.enqueteUniteLogement.enquete.id = :enqueteId
|
||||
// """)
|
||||
// void deleteByEnqueteId(@Param("enqueteId") Long enqueteId);
|
||||
@Query(nativeQuery = true,
|
||||
value = "select cul.id as idBackend, " +
|
||||
"cul.external_key as externalKey, " +
|
||||
|
||||
@@ -13,7 +13,7 @@ public interface EnqueteBatimentRepository extends JpaRepository<EnqueteBatiment
|
||||
Optional<EnqueteBatiment> findByMobileDataId(Long id);
|
||||
Optional<EnqueteBatiment> findFirstByExternalKeyAndTerminal_Id(Long externalKey, Long TerminalId);
|
||||
|
||||
List<EnqueteBatiment> findAllByEnquete_Id(Long enqueteId);
|
||||
//List<EnqueteBatiment> findAllByEnquete_Id(Long enqueteId);
|
||||
|
||||
@Query(
|
||||
nativeQuery = true,
|
||||
@@ -38,17 +38,17 @@ public interface EnqueteBatimentRepository extends JpaRepository<EnqueteBatiment
|
||||
"eb.surface_louee as surfaceLouee, " + //ok
|
||||
"eb.valeur_mensuelle_location as valeurMensuelleLocation, " + //ok
|
||||
"b.external_key as batimentId, " + //ok
|
||||
"e.external_key as enquteId, " + //ok
|
||||
// "e.external_key as enquteId, " + //ok
|
||||
"p2.external_key as personeId " + //ok
|
||||
"from enquete_batiment eb " +
|
||||
"inner join batiment b on b.id = eb.batiment_id " +
|
||||
"inner join parcelle p on p.id = b.parcelle_id " +
|
||||
"inner join personne p2 on p2.id = eb.personne_id " +
|
||||
"inner join enquete e on e.id = eb.enquete_id " +
|
||||
// "inner join enquete e on e.id = eb.enquete_id " +
|
||||
"WHERE eb.terminal_id = ?1"
|
||||
)
|
||||
List<EnqueteBatimentPayLoadRestor> getEnqueteBatimentByTerminalId(Long terminalId);
|
||||
|
||||
|
||||
void deleteAllByEnquete_Id(Long idEnquete);
|
||||
// void deleteAllByEnquete_Id(Long idEnquete);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ public interface EnqueteUniteLogementRepository extends JpaRepository<EnqueteUni
|
||||
Optional<EnqueteUniteLogement> findFirstByExternalKeyAndTerminal_Id(Long externalKey, Long TerminalId);
|
||||
Optional<EnqueteUniteLogement> findByMobileDataId(Long id);
|
||||
|
||||
List<EnqueteUniteLogement> findAllByEnquete_Id(Long id);
|
||||
//List<EnqueteUniteLogement> findAllByEnquete_Id(Long id);
|
||||
|
||||
@Query(nativeQuery = true,
|
||||
value = "select eul.id as idBackend, " +
|
||||
@@ -36,14 +36,14 @@ public interface EnqueteUniteLogementRepository extends JpaRepository<EnqueteUni
|
||||
"eul.date_fin_excemption as dateFinExcemption, " +
|
||||
"eul.personne_id as personneId, " +
|
||||
"eul.unite_logement_id as uniteLogementId, " +
|
||||
"eul.enquete_id as enqueteId, " +
|
||||
// "eul.enquete_id as enqueteId, " +
|
||||
"eul.user_id as userId " +
|
||||
"from enquete_unite_logement eul " +
|
||||
"inner join enquete e on e.id = eul.enquete_id " +
|
||||
// "inner join enquete e on e.id = eul.enquete_id " +
|
||||
"inner join unite_logement ul on eul.unite_logement_id = ul.id " +
|
||||
"inner join personne p on eul.personne_id = p.id " +
|
||||
"where eul.terminal_id = ?1")
|
||||
List<EnqueteUniteLogementPayLoadRestor> getEnqueteUniteLogementByTerminalId(Long terminalId);
|
||||
|
||||
void deleteAllByEnquete_id(Long id) ;
|
||||
// void deleteAllByEnquete_id(Long id) ;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,9 @@ public interface UserRepository extends JpaRepository<User, Long> {
|
||||
u.email,
|
||||
st.id,
|
||||
st.code,
|
||||
st.nom
|
||||
st.nom,
|
||||
u.active,
|
||||
u.resetPassword
|
||||
)
|
||||
FROM User u
|
||||
LEFT JOIN u.structure st
|
||||
@@ -54,7 +56,9 @@ public interface UserRepository extends JpaRepository<User, Long> {
|
||||
u.email,
|
||||
st.id,
|
||||
st.code,
|
||||
st.nom
|
||||
st.nom,
|
||||
u.active,
|
||||
u.resetPassword
|
||||
)
|
||||
FROM User u
|
||||
LEFT JOIN u.structure st
|
||||
@@ -72,7 +76,9 @@ public interface UserRepository extends JpaRepository<User, Long> {
|
||||
u.email,
|
||||
st.id,
|
||||
st.code,
|
||||
st.nom
|
||||
st.nom,
|
||||
u.active,
|
||||
u.resetPassword
|
||||
)
|
||||
FROM User u
|
||||
LEFT JOIN u.structure st
|
||||
@@ -91,7 +97,9 @@ public interface UserRepository extends JpaRepository<User, Long> {
|
||||
u.email,
|
||||
st.id,
|
||||
st.code,
|
||||
st.nom
|
||||
st.nom,
|
||||
u.active,
|
||||
u.resetPassword
|
||||
)
|
||||
FROM User u
|
||||
LEFT JOIN u.structure st
|
||||
@@ -114,7 +122,9 @@ public interface UserRepository extends JpaRepository<User, Long> {
|
||||
u.email,
|
||||
st.id,
|
||||
st.code,
|
||||
st.nom
|
||||
st.nom,
|
||||
u.active,
|
||||
u.resetPassword
|
||||
)
|
||||
FROM User u
|
||||
LEFT JOIN u.structure st
|
||||
@@ -133,7 +143,9 @@ public interface UserRepository extends JpaRepository<User, Long> {
|
||||
u.email,
|
||||
st.id,
|
||||
st.code,
|
||||
st.nom
|
||||
st.nom,
|
||||
u.active,
|
||||
u.resetPassword
|
||||
)
|
||||
FROM User u
|
||||
LEFT JOIN u.structure st
|
||||
|
||||
@@ -550,7 +550,7 @@ public class EntityFromPayLoadService {
|
||||
user.setNom(userPaylaodWeb.getNom());
|
||||
user.setPrenom(userPaylaodWeb.getPrenom());
|
||||
user.setTel(userPaylaodWeb.getTelephone());
|
||||
user.setActive(false);
|
||||
user.setActive(true);
|
||||
user.setResetPassword(true);
|
||||
return user ;
|
||||
}
|
||||
|
||||
435
src/main/java/io/gmss/fiscad/service/MailService.java
Executable file
435
src/main/java/io/gmss/fiscad/service/MailService.java
Executable file
@@ -0,0 +1,435 @@
|
||||
package io.gmss.fiscad.service;
|
||||
|
||||
|
||||
import io.gmss.fiscad.entities.user.User;
|
||||
import io.gmss.fiscad.enums.ParametersType;
|
||||
import io.gmss.fiscad.interfaces.ParametersRepository;
|
||||
import io.gmss.fiscad.utils.Mail;
|
||||
import io.gmss.fiscad.utils.MailPostmark;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@Service
|
||||
public class MailService {
|
||||
|
||||
private static String to;
|
||||
private static String from;
|
||||
|
||||
@Autowired
|
||||
Mail mail;
|
||||
|
||||
@Autowired
|
||||
MailPostmark mailPostmark;
|
||||
|
||||
@Autowired
|
||||
ParametersRepository parametersRepository;
|
||||
|
||||
// @Value("${}")
|
||||
// String defaultPassWord;
|
||||
|
||||
@Async
|
||||
public void sendMail(String to, String subject, String messageContent, String helloName) {
|
||||
if(to!=null ) {
|
||||
if (!to.trim().equals("")){
|
||||
messageContent = gethtmlMailFormat(subject, messageContent, helloName);
|
||||
mail.sendMessage(to, subject, messageContent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Async
|
||||
public void sendMailToKnownRecipients(String subject, String messageContent, String helloName) {
|
||||
|
||||
if(parametersRepository.findFirstByName(ParametersType.EMAILS_TO).isPresent()){
|
||||
to = parametersRepository.findFirstByName(ParametersType.EMAILS_TO).get().getValue();
|
||||
}
|
||||
|
||||
if(parametersRepository.findFirstByName(ParametersType.EMAIL_FROM).isPresent()){
|
||||
from = parametersRepository.findFirstByName(ParametersType.EMAIL_FROM).get().getValue();
|
||||
}
|
||||
messageContent = gethtmlMailFormat(subject,messageContent,helloName);
|
||||
String[] emails = to.trim().split(",");
|
||||
for(int i=0; i< emails.length; i++){
|
||||
// mail.sendMessage(from, emails[i].trim(), subject, messageContent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param subject
|
||||
* @param content
|
||||
* @param helloName
|
||||
* @return
|
||||
*/
|
||||
private String gethtmlMailFormat( String subject, String content, String helloName){
|
||||
|
||||
String messageContent= "\t<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n" +
|
||||
"\t<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:o=\"urn:schemas-microsoft-com:office:office\">\n" +
|
||||
"\n" +
|
||||
"\t<head>\n" +
|
||||
"\t\t\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n" +
|
||||
"\t\t\t<meta charset=\"utf-8\">\n" +
|
||||
"\t\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n" +
|
||||
"\t\t<title>Présidence de la République du Bénin</title>\n" +
|
||||
"\t\t<link href=\"https://fonts.googleapis.com/css?family=Montserrat:300,400,500\" rel=\"stylesheet\">\n" +
|
||||
"\t\t<style type=\"text/css\">\n" +
|
||||
"\t\t\t/* ----- Custom Font Import ----- */\n" +
|
||||
"\t\t\n" +
|
||||
"\t\t\t@media screen {\n" +
|
||||
"\t@font-face {\n" +
|
||||
"\t\tfont-family: 'Montserrat';\n" +
|
||||
"\t\tfont-style: normal;\n" +
|
||||
"\t\tfont-weight: 400;\n" +
|
||||
"\t\tsrc: local('Montserrat'), local('Montserrat'), url(https://fonts.googleapis.com/css?family=Montserrat:300,400,500) ;\n" +
|
||||
"\t}\n" +
|
||||
"\t\t\t}\n" +
|
||||
"\n" +
|
||||
"\t\t\t/* ----- Text Styles ----- */\n" +
|
||||
"\t\t\ttable {\n" +
|
||||
"\t\t\t\tfont-family: 'Montserrat', sans-serif;\n" +
|
||||
"\t\t\t\t-webkit-font-smoothing: antialiased;\n" +
|
||||
"\t\t\t\t-moz-font-smoothing: antialiased;\n" +
|
||||
"\t\t\t\tfont-smoothing: antialiased;\n" +
|
||||
"\t\t\t}\n" +
|
||||
"\n" +
|
||||
"\t\t\t@media only screen and (max-width: 700px) {\n" +
|
||||
"\n" +
|
||||
"\t\t\t\t/* ----- Base styles ----- */\n" +
|
||||
"\t\t\t\t.full-width-container {\n" +
|
||||
"\t\t\t\t\tpadding: 0 !important;\n" +
|
||||
"\t\t\t\t}\n" +
|
||||
"\n" +
|
||||
"\t\t\t\t.container {\n" +
|
||||
"\t\t\t\t\twidth: 100% !important;\n" +
|
||||
"\t\t\t\t}\n" +
|
||||
"\n" +
|
||||
"\t\t\t\t/* ----- Header ----- */\n" +
|
||||
"\t\t\t\t.header td {\n" +
|
||||
"\t\t\t\t\tpadding: 30px 15px 30px 15px !important;\n" +
|
||||
"\t\t\t\t}\n" +
|
||||
"\n" +
|
||||
"\t\t\t\t/* ----- Projects list ----- */\n" +
|
||||
"\t\t\t\t.projects-list {\n" +
|
||||
"\t\t\t\t\tdisplay: block !important;\n" +
|
||||
"\t\t\t\t}\n" +
|
||||
"\n" +
|
||||
"\t\t\t\t.projects-list tr {\n" +
|
||||
"\t\t\t\t\tdisplay: block !important;\n" +
|
||||
"\t\t\t\t}\n" +
|
||||
"\n" +
|
||||
"\t\t\t\t.projects-list td {\n" +
|
||||
"\t\t\t\t\tdisplay: block !important;\n" +
|
||||
"\t\t\t\t}\n" +
|
||||
"\n" +
|
||||
"\t\t\t\t.projects-list tbody {\n" +
|
||||
"\t\t\t\t\tdisplay: block !important;\n" +
|
||||
"\t\t\t\t}\n" +
|
||||
"\n" +
|
||||
"\t\t\t\t.projects-list img {\n" +
|
||||
"\t\t\t\t\tmargin: 0 auto 25px auto;\n" +
|
||||
"\t\t\t\t}\n" +
|
||||
"\n" +
|
||||
"\t\t\t\t/* ----- Half block ----- */\n" +
|
||||
"\t\t\t\t.half-block {\n" +
|
||||
"\t\t\t\t\tdisplay: block !important;\n" +
|
||||
"\t\t\t\t}\n" +
|
||||
"\n" +
|
||||
"\t\t\t\t.half-block tr {\n" +
|
||||
"\t\t\t\t\tdisplay: block !important;\n" +
|
||||
"\t\t\t\t}\n" +
|
||||
"\n" +
|
||||
"\t\t\t\t.half-block td {\n" +
|
||||
"\t\t\t\t\tdisplay: block !important;\n" +
|
||||
"\t\t\t\t}\n" +
|
||||
"\n" +
|
||||
"\t\t\t\t.half-block__image {\n" +
|
||||
"\t\t\t\t\twidth: 100% !important;\n" +
|
||||
"\t\t\t\t\tbackground-size: cover;\n" +
|
||||
"\t\t\t\t}\n" +
|
||||
"\n" +
|
||||
"\t\t\t\t.half-block__content {\n" +
|
||||
"\t\t\t\t\twidth: 100% !important;\n" +
|
||||
"\t\t\t\t\tbox-sizing: border-box;\n" +
|
||||
"\t\t\t\t\tpadding: 25px 15px 25px 15px !important;\n" +
|
||||
"\t\t\t\t}\n" +
|
||||
"\n" +
|
||||
"\t\t\t\t/* ----- Hero subheader ----- */\n" +
|
||||
"\t\t\t\t.hero-subheader__title {\n" +
|
||||
"\t\t\t\t\tpadding: 80px 15px 15px 15px !important;\n" +
|
||||
"\t\t\t\t\tfont-size: 35px !important;\n" +
|
||||
"\t\t\t\t}\n" +
|
||||
"\n" +
|
||||
"\t\t\t\t.hero-subheader__content {\n" +
|
||||
"\t\t\t\t\tpadding: 0 15px 90px 15px !important;\n" +
|
||||
"\t\t\t\t}\n" +
|
||||
"\n" +
|
||||
"\t\t\t\t/* ----- Title block ----- */\n" +
|
||||
"\t\t\t\t.title-block {\n" +
|
||||
"\t\t\t\t\tpadding: 0 15px 0 15px;\n" +
|
||||
"\t\t\t\t}\n" +
|
||||
"\n" +
|
||||
"\t\t\t\t/* ----- Paragraph block ----- */\n" +
|
||||
"\t\t\t\t.paragraph-block__content {\n" +
|
||||
"\t\t\t\t\tpadding: 25px 15px 18px 15px !important;\n" +
|
||||
"\t\t\t\t}\n" +
|
||||
"\n" +
|
||||
"\t\t\t\t/* ----- Info bullets ----- */\n" +
|
||||
"\t\t\t\t.info-bullets {\n" +
|
||||
"\t\t\t\t\tdisplay: block !important;\n" +
|
||||
"\t\t\t\t}\n" +
|
||||
"\n" +
|
||||
"\t\t\t\t.info-bullets tr {\n" +
|
||||
"\t\t\t\t\tdisplay: block !important;\n" +
|
||||
"\t\t\t\t}\n" +
|
||||
"\n" +
|
||||
"\t\t\t\t.info-bullets td {\n" +
|
||||
"\t\t\t\t\tdisplay: block !important;\n" +
|
||||
"\t\t\t\t}\n" +
|
||||
"\n" +
|
||||
"\t\t\t\t.info-bullets tbody {\n" +
|
||||
"\t\t\t\t\tdisplay: block;\n" +
|
||||
"\t\t\t\t}\n" +
|
||||
"\n" +
|
||||
"\t\t\t\t.info-bullets__icon {\n" +
|
||||
"\t\t\t\t\ttext-align: center;\n" +
|
||||
"\t\t\t\t\tpadding: 0 0 15px 0 !important;\n" +
|
||||
"\t\t\t\t}\n" +
|
||||
"\n" +
|
||||
"\t\t\t\t.info-bullets__content {\n" +
|
||||
"\t\t\t\t\ttext-align: center;\n" +
|
||||
"\t\t\t\t}\n" +
|
||||
"\n" +
|
||||
"\t\t\t\t.info-bullets__block {\n" +
|
||||
"\t\t\t\t\tpadding: 25px !important;\n" +
|
||||
"\t\t\t\t}\n" +
|
||||
"\n" +
|
||||
"\t\t\t\t/* ----- CTA block ----- */\n" +
|
||||
"\t\t\t\t.cta-block__title {\n" +
|
||||
"\t\t\t\t\tpadding: 35px 15px 0 15px !important;\n" +
|
||||
"\t\t\t\t}\n" +
|
||||
"\n" +
|
||||
"\t\t\t\t.cta-block__content {\n" +
|
||||
"\t\t\t\t\tpadding: 20px 15px 27px 15px !important;\n" +
|
||||
"\t\t\t\t}\n" +
|
||||
"\n" +
|
||||
"\t\t\t\t.cta-block__button {\n" +
|
||||
"\t\t\t\t\tpadding: 0 15px 0 15px !important;\n" +
|
||||
"\t\t\t\t}\n" +
|
||||
"\n" +
|
||||
"\t\t\t}\n" +
|
||||
"\n" +
|
||||
"\t\t\t.flag-container {\n" +
|
||||
"\t\t\t\twidth: 100%;\n" +
|
||||
"\t\t\t\theight: 8px;\n" +
|
||||
"\t\t\t\tmargin-bottom: 0;\n" +
|
||||
"\t\t\t}\n" +
|
||||
"\n" +
|
||||
"\t\t\t.flag {\n" +
|
||||
"\t\t\t\tpadding: 0;\n" +
|
||||
"\t\t\t\theight: 100%;\n" +
|
||||
"\t\t\t\twidth: 100%;\n" +
|
||||
"\t\t\t\tmargin-left: auto;\n" +
|
||||
"\t\t\t\tmargin-right: auto;\n" +
|
||||
"\t\t\t\tlist-style-type: none;\n" +
|
||||
"\t\t\t}\n" +
|
||||
"\n" +
|
||||
"\t\t\t.flag>li:first-child {\n" +
|
||||
"\t\t\t\tbackground: RGB(16, 135, 87);\n" +
|
||||
"\t\t\t}\n" +
|
||||
"\n" +
|
||||
"\t\t\t.flag>li {\n" +
|
||||
"\t\t\t\theight: 100%;\n" +
|
||||
"\t\t\t\tmargin: 0;\n" +
|
||||
"\t\t\t\tpadding: 0;\n" +
|
||||
"\t\t\t\twidth: 33.33%;\n" +
|
||||
"\t\t\t\tdisplay: inline-block;\n" +
|
||||
"\t\t\t\tbox-sizing: border-box;\n" +
|
||||
"\t\t\t\tvertical-align: middle;\n" +
|
||||
"\t\t\t\tfloat: left;\n" +
|
||||
"\t\t\t}\n" +
|
||||
"\n" +
|
||||
"\t\t\t.flag>li:first-child+li {\n" +
|
||||
"\t\t\t\tbackground: RGB(255, 190, 0);\n" +
|
||||
"\t\t\t\twidth: 33.34%;\n" +
|
||||
"\t\t\t}\n" +
|
||||
"\n" +
|
||||
"\t\t\t.flag li:first-child+li+li {\n" +
|
||||
"\t\t\t\tbackground: RGB(235, 0, 0);\n" +
|
||||
"\t\t\t}\n" +
|
||||
"\t\t</style>\n" +
|
||||
"\n" +
|
||||
"\t\t<!--[if gte mso 9]><xml>\n" +
|
||||
"\t\t\t\t<o:OfficeDocumentSettings>\n" +
|
||||
"\t\t\t\t\t<o:AllowPNG/>\n" +
|
||||
"\t\t\t\t\t<o:PixelsPerInch>96</o:PixelsPerInch>\n" +
|
||||
"\t\t\t\t</o:OfficeDocumentSettings>\n" +
|
||||
"\t\t\t</xml><![endif]-->\n" +
|
||||
"\t</head>\n" +
|
||||
"\n" +
|
||||
"\t<body style=\"padding: 0; margin: 0;\" bgcolor=\"#eeeeee\">\n" +
|
||||
"\t\t<span style=\"color:transparent !important; overflow:hidden !important; display:none !important; line-height:0px !important; height:0 !important; opacity:0 !important; visibility:hidden !important; width:0 !important; mso-hide:all;\"> mail de la DGI BENIN </span>\n" +
|
||||
"\n" +
|
||||
"\t\t<!-- / Full width container -->\n" +
|
||||
"\t\t<table class=\"full-width-container\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" height=\"100%\" width=\"100%\" bgcolor=\"#eeeeee\"\n" +
|
||||
"\t\tstyle=\"width: 100%; height: 100%; padding: 30px 0 30px 0;\">\n" +
|
||||
"\t\t\t<tr>\n" +
|
||||
"\t\t\t\t<td align=\"center\" valign=\"top\">\n" +
|
||||
"\t\t\t\t\t<!-- / 700px container -->\n" +
|
||||
"\t\t\t\t\t<table class=\"container\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"700\" bgcolor=\"#ffffff\" style=\"width: 700px;\">\n" +
|
||||
"\t\t\t\t\t\t<tr>\n" +
|
||||
"\t\t\t\t\t\t\t<td align=\"center\" valign=\"top\">\n" +
|
||||
"\t\t\t\t\t\t\t\t<!-- / Header -->\n" +
|
||||
"\t\t\t\t\t\t\t\t<table style=\" background: #00a99d;\n" +
|
||||
"\t\t\t\t\t\t\t\twidth: 100%;\n" +
|
||||
"\t\t\t\t\t\t\t\ttext-align: center;\n" +
|
||||
"\t\t\t\t\t\t\t\tcolor: #FFF;\">\n" +
|
||||
"\t\t\t\t\t\t\t\t\t<tr>\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t<td style=\"padding: 30px 0 30px 0; \">\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t\t<h1>"+subject+"</h1>\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t</td>\n" +
|
||||
"\t\t\t\t\t\t\t\t\t</tr>\n" +
|
||||
"\t\t\t\t\t\t\t\t</table>\n" +
|
||||
"\t\t\t\t\t\t\t\t<!-- /// Header -->\n" +
|
||||
"\n" +
|
||||
"\t\t\t\t\t\t\t\t<!-- / Hero subheader -->\n" +
|
||||
"\n" +
|
||||
"\t\t\t\t\t\t\t\t<table class=\"container hero-subheader\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"620\" style=\"width: 620px;\">\n" +
|
||||
"\t\t\t\t\t\t\t\t\t<tr>\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t<td class=\"hero-subheader__title\" style=\"font-size: 20px; font-weight: bold; padding: 40px 0 15px 0;\" align=\"left\">\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t\t"+helloName+"</td>\n" +
|
||||
"\t\t\t\t\t\t\t\t\t</tr>\n" +
|
||||
"\n" +
|
||||
"\t\t\t\t\t\t\t\t\t<tr>\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t<td class=\"hero-subheader__content\" style=\"font-size: 16px; line-height: 27px; color: #969696; padding: 0 60px 60px 0; text-align: justify\">\n" +
|
||||
"\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t\t<p>"+content+".\n" +
|
||||
"\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t\t</p>\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t</td>\n" +
|
||||
"\t\t\t\t\t\t\t\t\t</tr>\n" +
|
||||
"\t\t\t\t\t\t\t\t\t<tr>\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t<td class=\"hero-subheader__content\" style=\"font-size: 12px; line-height: 27px; color: #969696; padding: 0 40px 40px 0;\"\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\talign=\"left\">\n" +
|
||||
"\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t\tPlease remember to protect the environment. Print only if necessary. Recycle the paper. \n N'oubliez pas de protéger la nature. Imprimez cet email seulement si c'est nécessaire et pensez à recycler votre papier.\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t\tTelephone : +229 90 19 00 00 <br>\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t\tEmail : <a href=\"mailto:cdgi@finances.bj\">cdgi@finances.bj</a>\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t</td>\n" +
|
||||
"\t\t\t\t\t\t\t\t\t</tr>\n" +
|
||||
"\t\t\t\t\t\t\t\t</table>\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
"\t\t\t\t\t\t\t\t<!-- / Footer -->\n" +
|
||||
"\t\t\t\t\t\t\t\t<table class=\"container\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" align=\"center\">\n" +
|
||||
"\n" +
|
||||
"\t\t\t\t\t\t\t\t\t<tr>\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t<td align=\"center\">\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t\t<table class=\"container\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"620\" align=\"center\" style=\"border-top: 1px solid #eeeeee; width: 620px;\">\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t\t\t<tr>\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t\t\t\t<td style=\"text-align: center; background: #FFF; padding: 30px 0 30px 0; width: 100%;\">\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img src=\"https://ifu.impots.bj/assets/img/logo.png\" alt=\"Logo - DGI\"\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t\t\t\t\tstyle=\" width: 250px;\">\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t\t\t\t\t<br>\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t\t\t\t</td>\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t\t\t</tr>\n" +
|
||||
"\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t\t\t<tr>\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t\t\t\t<td align=\"middle\">\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t\t\t\t\t<table width=\"60\" height=\"2\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"width: 60px; height: 2px;\">\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<tr>\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td align=\"middle\" width=\"60\" height=\"2\" style=\"background-color: #eeeeee; width: 60px; height: 2px; font-size: 1px;\">DGI-\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tDGI</td>\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</tr>\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t\t\t\t\t</table>\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t\t\t\t</td>\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t\t\t</tr>\n" +
|
||||
"\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t\t\t<tr>\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t\t\t\t<td style=\"color: #d5d5d5; text-align: center; font-size: 15px; padding: 10px 0 60px 0; line-height: 22px;\">Copyright\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t\t\t\t\t© 2021 <a href=\"https://www.impots.bj\" target=\"_blank\" style=\"text-decoration: none; border-bottom: 1px solid #d5d5d5; color: #d5d5d5;\">-\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tDGI</a>.\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t\t\t\t\t<br />Tout droit reserves</td>\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t\t\t</tr>\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t\t</table>\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t</td>\n" +
|
||||
"\t\t\t\t\t\t\t\t\t</tr>\n" +
|
||||
"\t\t\t\t\t\t\t\t</table>\n" +
|
||||
"\t\t\t\t\t\t\t\t<!-- /// Footer -->\n" +
|
||||
"\n" +
|
||||
"\t\t\t\t\t\t\t\t<div class=\"flag-container\">\n" +
|
||||
"\t\t\t\t\t\t\t\t\t<ul class=\"flag\">\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t<li style=\"background: RGB(16, 135, 87);\"></li>\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t<li style=\"background: RGB(255, 190, 0);\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\twidth: 33.34%;\"></li>\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t<li style=\"background: RGB(235, 0, 0);\"></li>\n" +
|
||||
"\t\t\t\t\t\t\t\t\t</ul>\n" +
|
||||
"\t\t\t\t\t\t\t\t</div>\n" +
|
||||
"\t\t\t\t\t\t\t</td>\n" +
|
||||
"\t\t\t\t\t\t</tr>\n" +
|
||||
"\t\t\t\t\t</table>\n" +
|
||||
"\n" +
|
||||
"\t\t\t\t</td>\n" +
|
||||
"\t\t\t</tr>\n" +
|
||||
"\t\t</table>\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
"\t</body>\n" +
|
||||
"\n" +
|
||||
"\t</html>";
|
||||
return messageContent;
|
||||
|
||||
}
|
||||
|
||||
public void sendAccountCreatedMail(User user, String defaultPassWord) {
|
||||
String subject = "Notification de creation de compte.";
|
||||
String helloName = "Monsieur / Madame " + user.getNom() + " " + user.getPrenom();
|
||||
StringBuilder message = new StringBuilder();
|
||||
message.append(".<br/>");
|
||||
message.append("Votre login : <strong>" + user.getUsername() + "</strong><br/>");
|
||||
message.append("Des votre premiere connexion, pensez a modifier votre mot de passe par defaut qui est genere par le systeme.<br/><br/>");
|
||||
message.append("Votre mot de passe : <b>" + defaultPassWord + "</b><br/>");
|
||||
|
||||
try{
|
||||
sendMail(user.getEmail(), subject, message.toString(), helloName);
|
||||
}catch (Exception e){
|
||||
// e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void sendAccountReinitMail(User user, String passWord) {
|
||||
String subject = "Notification de réinitialisation de compte.";
|
||||
String helloName = "Monsieur / Madame " + user.getNom() + " " + user.getPrenom();
|
||||
StringBuilder message = new StringBuilder();
|
||||
message.append(".<br/>");
|
||||
message.append("Votre login : <strong>" + user.getUsername() + "</strong><br/>");
|
||||
|
||||
message.append("Dès votre première connexion, pensez à modifier votre mot de passe par défaut qui est généré par le système.<br/><br/>");
|
||||
message.append("Votre mot de passe : <b>" + passWord + "</b><br/>");
|
||||
|
||||
try{
|
||||
//sendMail(user.getEmail(), subject, message.toString(), helloName);
|
||||
sendPostmarkMail(user.getEmail(),subject, message.toString(),helloName,null) ;
|
||||
}catch (Exception e){
|
||||
// e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Async
|
||||
public Boolean sendPostmarkMail(String to, String subject, String messageContent, String helloName, String fileName) throws IOException {
|
||||
String from ;
|
||||
if(parametersRepository.findFirstByName(ParametersType.EMAIL_FROM).isPresent()){
|
||||
from = parametersRepository.findFirstByName(ParametersType.EMAIL_FROM).get().getValue();
|
||||
messageContent = gethtmlMailFormat(subject,messageContent,helloName);
|
||||
return mailPostmark.sendMessage(to, subject, messageContent, fileName, from);
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.gmss.fiscad.service;
|
||||
|
||||
import io.gmss.fiscad.utils.FileNameGenerator;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
@@ -30,4 +31,39 @@ public class StringService {
|
||||
NumberFormat formatter = new DecimalFormat("000");
|
||||
return formatter.format(input);
|
||||
}
|
||||
public String getAlphaNumericString(int n)
|
||||
{
|
||||
// chose a Character random from this String
|
||||
String AlphaNumericString = "0123456789";
|
||||
// create StringBuffer size of AlphaNumericString
|
||||
StringBuilder sb = new StringBuilder(n);
|
||||
|
||||
for (int i = 0; i < n; i++) {
|
||||
|
||||
// generate a random number between
|
||||
// 0 to AlphaNumericString variable length
|
||||
int index
|
||||
= (int)(AlphaNumericString.length()
|
||||
* Math.random());
|
||||
|
||||
// add Character one by one in end of sb
|
||||
sb.append(AlphaNumericString
|
||||
.charAt(index));
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String generatePassword() {
|
||||
String numero = null;
|
||||
try {
|
||||
numero = FileNameGenerator.generateString().toUpperCase().substring(0, 6);
|
||||
return numero;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,30 +228,30 @@ public class EnqueteAsyncWorker {
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
//
|
||||
// try {
|
||||
// caracteristiqueBatimentRepository.deleteByEnqueteId(idEnquete);
|
||||
// } catch (Exception e) {
|
||||
//
|
||||
// }
|
||||
|
||||
try {
|
||||
caracteristiqueBatimentRepository.deleteByEnqueteId(idEnquete);
|
||||
} catch (Exception e) {
|
||||
// try {
|
||||
// caracteristiqueUniteLogementRepository.deleteByEnqueteId(idEnquete);
|
||||
// } catch (Exception e) {
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
||||
// try {
|
||||
// enqueteBatimentRepository.deleteAllByEnquete_Id(idEnquete);
|
||||
// } catch (Exception e) {
|
||||
//
|
||||
// }
|
||||
|
||||
try {
|
||||
caracteristiqueUniteLogementRepository.deleteByEnqueteId(idEnquete);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
enqueteBatimentRepository.deleteAllByEnquete_Id(idEnquete);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
enqueteUniteLogementRepository.deleteAllByEnquete_id(idEnquete);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
// try {
|
||||
// enqueteUniteLogementRepository.deleteAllByEnquete_id(idEnquete);
|
||||
// } catch (Exception e) {
|
||||
//
|
||||
// }
|
||||
|
||||
try {
|
||||
uniteLogementRepository.deleteByEnqueteId(idEnquete);
|
||||
|
||||
@@ -127,10 +127,10 @@ public class EnqueteBatimentAsyncWorker {
|
||||
enqueteBatiment.setBatiment(optionalBatiment.orElse(null));
|
||||
}
|
||||
|
||||
if (enqueteBatimentPayload.getEnqueteId() != null) {
|
||||
Optional<Enquete> optionalEnquete = enqueteRepository.findFirstByExternalKeyAndTerminal_Id(enqueteBatimentPayload.getEnqueteId(), enqueteBatimentPayload.getTerminalId());
|
||||
enqueteBatiment.setEnquete(optionalEnquete.orElse(null));
|
||||
}
|
||||
// if (enqueteBatimentPayload.getEnqueteId() != null) {
|
||||
// Optional<Enquete> optionalEnquete = enqueteRepository.findFirstByExternalKeyAndTerminal_Id(enqueteBatimentPayload.getEnqueteId(), enqueteBatimentPayload.getTerminalId());
|
||||
// enqueteBatiment.setEnquete(optionalEnquete.orElse(null));
|
||||
// }
|
||||
if (enqueteBatimentPayload.getTerminalId() != null) {
|
||||
Optional<Tpe> optionalTpe = tpeRepository.findById(enqueteBatimentPayload.getTerminalId());
|
||||
enqueteBatiment.setTerminal(optionalTpe.orElse(null));
|
||||
|
||||
@@ -106,10 +106,10 @@ public class EnqueteUniteLogementAsyncWorker {
|
||||
enqueteUniteLogement.setUniteLogement(optionalUniteLogement.orElse(null));
|
||||
}
|
||||
|
||||
if (enqueteUniteLogementPayload.getEnqueteId() != null) {
|
||||
Optional<Enquete> optionalEnquete = enqueteRepository.findFirstByExternalKeyAndTerminal_Id(enqueteUniteLogementPayload.getEnqueteId(), enqueteUniteLogementPayload.getTerminalId());
|
||||
enqueteUniteLogement.setEnquete(optionalEnquete.orElse(null));
|
||||
}
|
||||
// if (enqueteUniteLogementPayload.getEnqueteId() != null) {
|
||||
// Optional<Enquete> optionalEnquete = enqueteRepository.findFirstByExternalKeyAndTerminal_Id(enqueteUniteLogementPayload.getEnqueteId(), enqueteUniteLogementPayload.getTerminalId());
|
||||
// enqueteUniteLogement.setEnquete(optionalEnquete.orElse(null));
|
||||
// }
|
||||
if (enqueteUniteLogementPayload.getTerminalId() != null) {
|
||||
Optional<Tpe> optionalTpe = tpeRepository.findById(enqueteUniteLogementPayload.getTerminalId());
|
||||
enqueteUniteLogement.setTerminal(optionalTpe.orElse(null));
|
||||
|
||||
@@ -4,6 +4,7 @@ import io.gmss.fiscad.entities.decoupage.Quartier;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Parcelle;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Tpe;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.NatureDomaine;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.TypeDomaine;
|
||||
import io.gmss.fiscad.entities.metadata.MobileDataParcelle;
|
||||
import io.gmss.fiscad.enums.TypeObjet;
|
||||
import io.gmss.fiscad.paylaods.request.synchronisation.ParcellePayLoad;
|
||||
@@ -11,6 +12,7 @@ import io.gmss.fiscad.persistence.repositories.decoupage.QuartierRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.ParcelleRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.TpeRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.parametre.NatureDomaineRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.parametre.TypeDomaineRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.metadata.MobileDataParcelleRepository;
|
||||
import io.gmss.fiscad.service.LogService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -27,6 +29,7 @@ public class ParcelleAsyncWorker {
|
||||
private final NatureDomaineRepository natureDomaineRepository;
|
||||
private final QuartierRepository quartierRepository;
|
||||
private final LogService logService;
|
||||
private final TypeDomaineRepository typeDomaineRepository;
|
||||
//@Async("parcelleExecutor")
|
||||
public void traitementAsyncParcelle(MobileDataParcelle mobileDataParcelle) {
|
||||
ParcellePayLoad parcellePayLoad = mobileDataParcelle.getParcellePayLoad();
|
||||
@@ -78,6 +81,12 @@ public class ParcelleAsyncWorker {
|
||||
Optional<Tpe> optionalTpe = tpeRepository.findById(parcellePayLoad.getTerminalId());
|
||||
parcelle.setTerminal(optionalTpe.orElse(null));
|
||||
}
|
||||
|
||||
if (parcellePayLoad.getTypeDomaineId() != null) {
|
||||
Optional<TypeDomaine> optionalTypeDomaine = typeDomaineRepository.findById(parcellePayLoad.getTypeDomaineId());
|
||||
parcelle.setTypeDomaine(optionalTypeDomaine.orElse(null));
|
||||
}
|
||||
|
||||
parcelle.setExternalKey(parcellePayLoad.getExternalKey());
|
||||
parcelle.setNupProvisoire(parcellePayLoad.getNupProvisoire());
|
||||
parcelle.setQ(parcellePayLoad.getQ());
|
||||
@@ -87,7 +96,7 @@ public class ParcelleAsyncWorker {
|
||||
parcelle.setLongitude(parcellePayLoad.getLongitude());
|
||||
parcelle.setLatitude(parcellePayLoad.getLatitude());
|
||||
parcelle.setNumTitreFoncier(parcellePayLoad.getNumTitreFoncier());
|
||||
parcelle.setTypeDomaineId(parcellePayLoad.getTypeDomaineId());
|
||||
// parcelle.setTypeDomaineId(parcellePayLoad.getTypeDomaineId());
|
||||
parcelle.setNumeroProvisoire(parcellePayLoad.getNumeroProvisoire());
|
||||
parcelle.setBlocId(parcellePayLoad.getBlocId());
|
||||
parcelle.setObservation(parcellePayLoad.getObservation());
|
||||
|
||||
88
src/main/java/io/gmss/fiscad/utils/Mail.java
Executable file
88
src/main/java/io/gmss/fiscad/utils/Mail.java
Executable file
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* 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.fiscad.utils;
|
||||
|
||||
|
||||
import io.gmss.fiscad.enums.ParametersType;
|
||||
import io.gmss.fiscad.interfaces.ParametersRepository;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import jakarta.mail.*;
|
||||
import jakarta.mail.internet.InternetAddress;
|
||||
import jakarta.mail.internet.MimeMessage;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author AKPONA Christian
|
||||
*/
|
||||
@Service
|
||||
public class Mail {
|
||||
|
||||
private static String port;
|
||||
private static String host;
|
||||
private static String username;
|
||||
private static String password;
|
||||
|
||||
@Autowired
|
||||
ParametersRepository parametersRepository;
|
||||
|
||||
public boolean sendMessage(String to, String subject, String messageContent) {
|
||||
boolean retour;
|
||||
System.out.println(username+" "+password+" "+port+" "+host);
|
||||
Properties props = new Properties();
|
||||
props.put("mail.smtp.auth", "true");
|
||||
props.put("mail.smtp.starttls.enable", "true");
|
||||
props.put("mail.smtp.host", host);
|
||||
props.put("mail.smtp.port", port);
|
||||
Session session = Session.getInstance(props,
|
||||
new Authenticator() {
|
||||
protected PasswordAuthentication getPasswordAuthentication() {
|
||||
return new PasswordAuthentication(username, password);
|
||||
}
|
||||
});
|
||||
try {
|
||||
Message message = new MimeMessage(session);
|
||||
message.setFrom(new InternetAddress(username));
|
||||
message.setRecipients(Message.RecipientType.TO,
|
||||
InternetAddress.parse(to));
|
||||
message.setSubject(subject);
|
||||
message.setContent(messageContent, "text/html");
|
||||
|
||||
Transport.send(message);
|
||||
|
||||
retour = true;
|
||||
|
||||
} catch (MessagingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return retour;
|
||||
}
|
||||
|
||||
|
||||
@PostConstruct
|
||||
public void init(){
|
||||
if(parametersRepository.findFirstByName(ParametersType.SMTP_HOST).isPresent()){
|
||||
host = parametersRepository.findFirstByName(ParametersType.SMTP_HOST).get().getValue();
|
||||
}
|
||||
|
||||
if(parametersRepository.findFirstByName(ParametersType.SMTP_PORT).isPresent()){
|
||||
port = parametersRepository.findFirstByName(ParametersType.SMTP_PORT).get().getValue();
|
||||
}
|
||||
|
||||
if(parametersRepository.findFirstByName(ParametersType.SMTP_USERNAME).isPresent()){
|
||||
username = parametersRepository.findFirstByName(ParametersType.SMTP_USERNAME).get().getValue();
|
||||
}
|
||||
|
||||
if(parametersRepository.findFirstByName(ParametersType.SMTP_PASSWORD).isPresent()){
|
||||
password = parametersRepository.findFirstByName(ParametersType.SMTP_PASSWORD).get().getValue();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
72
src/main/java/io/gmss/fiscad/utils/MailPostmark.java
Executable file
72
src/main/java/io/gmss/fiscad/utils/MailPostmark.java
Executable file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* 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.fiscad.utils;
|
||||
|
||||
|
||||
import com.wildbit.java.postmark.Postmark;
|
||||
import com.wildbit.java.postmark.client.ApiClient;
|
||||
import com.wildbit.java.postmark.client.data.model.message.Message;
|
||||
import com.wildbit.java.postmark.client.exception.PostmarkException;
|
||||
import io.gmss.fiscad.enums.ParametersType;
|
||||
import io.gmss.fiscad.interfaces.ParametersRepository;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.IOException;
|
||||
//import java.util.Properties;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author AKPONA Christian
|
||||
*/
|
||||
@Service
|
||||
public class MailPostmark {
|
||||
|
||||
private static String port;
|
||||
private static String host;
|
||||
private static String username;
|
||||
private static String password;
|
||||
|
||||
@Autowired
|
||||
ParametersRepository parametersRepository;
|
||||
|
||||
|
||||
|
||||
@PostConstruct
|
||||
public void init(){
|
||||
if(parametersRepository.findFirstByName(ParametersType.SMTP_HOST).isPresent()){
|
||||
host = parametersRepository.findFirstByName(ParametersType.SMTP_HOST).get().getValue();
|
||||
}
|
||||
|
||||
if(parametersRepository.findFirstByName(ParametersType.SMTP_PORT).isPresent()){
|
||||
port = parametersRepository.findFirstByName(ParametersType.SMTP_PORT).get().getValue();
|
||||
}
|
||||
|
||||
if(parametersRepository.findFirstByName(ParametersType.SMTP_USERNAME).isPresent()){
|
||||
username = parametersRepository.findFirstByName(ParametersType.SMTP_USERNAME).get().getValue();
|
||||
}
|
||||
|
||||
if(parametersRepository.findFirstByName(ParametersType.SMTP_PASSWORD).isPresent()){
|
||||
password = parametersRepository.findFirstByName(ParametersType.SMTP_PASSWORD).get().getValue();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean sendMessage(String to, String subject, String body, String fileToAttach, String from) throws IOException {
|
||||
try {
|
||||
ApiClient client = Postmark.getApiClient("7e04713f-d019-41b0-b91b-90bfb52bb41c");
|
||||
Message message = new Message(from, to, subject, body);
|
||||
message.setMessageStream("outbound");
|
||||
// message.addAttachment(fileToAttach);
|
||||
client.deliverMessage(message);
|
||||
} catch (PostmarkException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
spring.profiles.active=${SPRING_PROFILES_ACTIVE}
|
||||
#spring.profiles.active=abomey
|
||||
# spring.profiles.active=test
|
||||
#spring.profiles.active=test
|
||||
spring.jpa.properties.hibernate.id.new_generator_mappings=false
|
||||
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
|
||||
spring.jpa.open-in-view=false
|
||||
|
||||
Reference in New Issue
Block a user