Sync: code local unifié
Synchronisation du code source local (fait foi). Signed-off-by: lions dev Team
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
package dev.lions.unionflow.server.resource.mutuelle.credit;
|
||||
|
||||
import dev.lions.unionflow.server.api.dto.mutuelle.credit.DemandeCreditRequest;
|
||||
import dev.lions.unionflow.server.api.dto.mutuelle.credit.DemandeCreditResponse;
|
||||
import dev.lions.unionflow.server.api.enums.mutuelle.credit.StatutDemandeCredit;
|
||||
import dev.lions.unionflow.server.service.mutuelle.credit.DemandeCreditService;
|
||||
|
||||
import jakarta.annotation.security.RolesAllowed;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.ws.rs.*;
|
||||
import jakarta.ws.rs.core.MediaType;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@Path("/api/v1/mutuelle/credits")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public class DemandeCreditResource {
|
||||
|
||||
@Inject
|
||||
DemandeCreditService demandeCreditService;
|
||||
|
||||
@POST
|
||||
@RolesAllowed({ "membre_actif" })
|
||||
public Response soumettreDemande(@Valid DemandeCreditRequest request) {
|
||||
DemandeCreditResponse response = demandeCreditService.soumettreDemande(request);
|
||||
return Response.status(Response.Status.CREATED).entity(response).build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/{id}")
|
||||
@RolesAllowed({ "admin", "admin_organisation", "mutuelle_resp", "membre_actif" })
|
||||
public Response getDemandeById(@PathParam("id") UUID id) {
|
||||
DemandeCreditResponse response = demandeCreditService.getDemandeById(id);
|
||||
return Response.ok(response).build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/membre/{membreId}")
|
||||
@RolesAllowed({ "admin", "admin_organisation", "mutuelle_resp", "membre_actif" })
|
||||
public Response getDemandesByMembre(@PathParam("membreId") UUID membreId) {
|
||||
List<DemandeCreditResponse> response = demandeCreditService.getDemandesByMembre(membreId);
|
||||
return Response.ok(response).build();
|
||||
}
|
||||
|
||||
@PATCH
|
||||
@Path("/{id}/statut")
|
||||
@RolesAllowed({ "admin", "admin_organisation", "mutuelle_resp" })
|
||||
public Response changerStatut(
|
||||
@PathParam("id") UUID id,
|
||||
@QueryParam("statut") StatutDemandeCredit statut,
|
||||
@QueryParam("notes") String notes) {
|
||||
if (statut == null) {
|
||||
return Response.status(Response.Status.BAD_REQUEST).entity("Le statut est requis").build();
|
||||
}
|
||||
DemandeCreditResponse response = demandeCreditService.changerStatut(id, statut, notes);
|
||||
return Response.ok(response).build();
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/{id}/approbation")
|
||||
@RolesAllowed({ "admin", "admin_organisation", "mutuelle_resp" })
|
||||
public Response approuver(
|
||||
@PathParam("id") UUID id,
|
||||
@QueryParam("montant") BigDecimal montant,
|
||||
@QueryParam("duree") Integer duree,
|
||||
@QueryParam("taux") BigDecimal taux,
|
||||
@QueryParam("notes") String notes) {
|
||||
DemandeCreditResponse response = demandeCreditService.approuver(id, montant, duree, taux, notes);
|
||||
return Response.ok(response).build();
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/{id}/decaissement")
|
||||
@RolesAllowed({ "admin", "admin_organisation", "mutuelle_resp" })
|
||||
public Response decaisser(
|
||||
@PathParam("id") UUID id,
|
||||
@QueryParam("datePremiereEcheance") String datePremiereEcheance) {
|
||||
LocalDate date = LocalDate.parse(datePremiereEcheance);
|
||||
DemandeCreditResponse response = demandeCreditService.decaisser(id, date);
|
||||
return Response.ok(response).build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package dev.lions.unionflow.server.resource.mutuelle.epargne;
|
||||
|
||||
import dev.lions.unionflow.server.api.dto.mutuelle.epargne.CompteEpargneRequest;
|
||||
import dev.lions.unionflow.server.api.dto.mutuelle.epargne.CompteEpargneResponse;
|
||||
import dev.lions.unionflow.server.api.enums.mutuelle.epargne.StatutCompteEpargne;
|
||||
import dev.lions.unionflow.server.service.mutuelle.epargne.CompteEpargneService;
|
||||
|
||||
import jakarta.annotation.security.RolesAllowed;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.ws.rs.*;
|
||||
import jakarta.ws.rs.core.MediaType;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@Path("/api/v1/epargne/comptes")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public class CompteEpargneResource {
|
||||
|
||||
@Inject
|
||||
CompteEpargneService compteEpargneService;
|
||||
|
||||
@POST
|
||||
@RolesAllowed({ "admin", "admin_organisation", "ADMIN", "ADMIN_ORGANISATION", "mutuelle_resp" })
|
||||
public Response creerCompte(@Valid CompteEpargneRequest request) {
|
||||
CompteEpargneResponse compte = compteEpargneService.creerCompte(request);
|
||||
return Response.status(Response.Status.CREATED).entity(compte).build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/{id}")
|
||||
@RolesAllowed({ "admin", "admin_organisation", "ADMIN", "ADMIN_ORGANISATION", "mutuelle_resp", "membre_actif", "MEMBRE", "USER" })
|
||||
public Response getCompteById(@PathParam("id") UUID id) {
|
||||
CompteEpargneResponse compte = compteEpargneService.getCompteById(id);
|
||||
return Response.ok(compte).build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/mes-comptes")
|
||||
@RolesAllowed({ "admin", "admin_organisation", "ADMIN", "ADMIN_ORGANISATION", "mutuelle_resp", "membre_actif", "MEMBRE", "USER" })
|
||||
public Response getMesComptes() {
|
||||
List<CompteEpargneResponse> comptes = compteEpargneService.getMesComptes();
|
||||
return Response.ok(comptes).build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/membre/{membreId}")
|
||||
@RolesAllowed({ "admin", "admin_organisation", "ADMIN", "ADMIN_ORGANISATION", "mutuelle_resp", "membre_actif", "MEMBRE", "USER" })
|
||||
public Response getComptesByMembre(@PathParam("membreId") UUID membreId) {
|
||||
List<CompteEpargneResponse> comptes = compteEpargneService.getComptesByMembre(membreId);
|
||||
return Response.ok(comptes).build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/organisation/{organisationId}")
|
||||
@RolesAllowed({ "admin", "admin_organisation", "ADMIN", "ADMIN_ORGANISATION", "mutuelle_resp" })
|
||||
public Response getComptesByOrganisation(@PathParam("organisationId") UUID organisationId) {
|
||||
List<CompteEpargneResponse> comptes = compteEpargneService.getComptesByOrganisation(organisationId);
|
||||
return Response.ok(comptes).build();
|
||||
}
|
||||
|
||||
@PATCH
|
||||
@Path("/{id}/statut")
|
||||
@RolesAllowed({ "admin", "admin_organisation", "ADMIN", "ADMIN_ORGANISATION", "mutuelle_resp" })
|
||||
public Response changerStatut(@PathParam("id") UUID id, @QueryParam("statut") StatutCompteEpargne statut) {
|
||||
if (statut == null) {
|
||||
return Response.status(Response.Status.BAD_REQUEST).entity("Le statut est requis").build();
|
||||
}
|
||||
CompteEpargneResponse compte = compteEpargneService.changerStatut(id, statut);
|
||||
return Response.ok(compte).build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package dev.lions.unionflow.server.resource.mutuelle.epargne;
|
||||
|
||||
import dev.lions.unionflow.server.api.dto.mutuelle.epargne.TransactionEpargneRequest;
|
||||
import dev.lions.unionflow.server.api.dto.mutuelle.epargne.TransactionEpargneResponse;
|
||||
import dev.lions.unionflow.server.service.mutuelle.epargne.TransactionEpargneService;
|
||||
|
||||
import jakarta.annotation.security.RolesAllowed;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.ws.rs.*;
|
||||
import jakarta.ws.rs.core.MediaType;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@Path("/api/v1/epargne/transactions")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public class TransactionEpargneResource {
|
||||
|
||||
@Inject
|
||||
TransactionEpargneService transactionEpargneService;
|
||||
|
||||
@POST
|
||||
@RolesAllowed({ "admin", "admin_organisation", "ADMIN", "ADMIN_ORGANISATION", "mutuelle_resp", "MEMBRE", "MEMBRE_ACTIF", "membre_actif", "USER" })
|
||||
public Response executerTransaction(@Valid TransactionEpargneRequest request) {
|
||||
TransactionEpargneResponse transaction = transactionEpargneService.executerTransaction(request);
|
||||
return Response.status(Response.Status.CREATED).entity(transaction).build();
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/transfert")
|
||||
@RolesAllowed({ "admin", "admin_organisation", "ADMIN", "ADMIN_ORGANISATION", "mutuelle_resp", "membre_actif", "MEMBRE_ACTIF", "MEMBRE", "USER" })
|
||||
public Response transferer(@Valid TransactionEpargneRequest request) {
|
||||
TransactionEpargneResponse transaction = transactionEpargneService.transferer(request);
|
||||
return Response.status(Response.Status.CREATED).entity(transaction).build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/compte/{compteId}")
|
||||
@RolesAllowed({ "admin", "admin_organisation", "ADMIN", "ADMIN_ORGANISATION", "mutuelle_resp", "membre_actif", "MEMBRE_ACTIF", "MEMBRE", "USER" })
|
||||
public Response getTransactionsByCompte(@PathParam("compteId") UUID compteId) {
|
||||
List<TransactionEpargneResponse> transactions = transactionEpargneService.getTransactionsByCompte(compteId);
|
||||
return Response.ok(transactions).build();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user