- MOSTRAR POR RUTA EN EL TELEFONO DE RUTA LOS CLIENTES SIN RENOVAR

This commit is contained in:
Brayan.Gonzalez 2025-06-13 11:57:52 -06:00
parent 25fde10e97
commit 6ec0f569e1
14 changed files with 517 additions and 220 deletions

View File

@ -1,16 +1,19 @@
/*
* Arrebol Consultancy copyright.
*
*
* This code belongs to Arrebol Consultancy
* its use, redistribution or modification are prohibited
* its use, redistribution or modification are prohibited
* without written authorization from Arrebol Consultancy.
*/
package com.arrebol.apc.controller.mobile.controller.customer;
import com.arrebol.apc.controller.mobile.repository.views.CustomerWithoutRenovationViewRepository;
import com.arrebol.apc.controller.mobile.repository.views.LoanByUserViewRepository;
import com.arrebol.apc.model.ModelParameter;
import com.arrebol.apc.model.core.constance.CustomerWithoutRenovationViewCfg;
import com.arrebol.apc.model.core.constance.LoanByUserViewCfg;
import com.arrebol.apc.model.enums.PreferenceValue;
import com.arrebol.apc.model.views.CustomerWithoutRenovationView;
import com.arrebol.apc.model.views.LoanByUserView;
import java.io.Serializable;
import java.util.ArrayList;
@ -24,40 +27,65 @@ import org.apache.logging.log4j.Logger;
*/
public class CustomerController implements Serializable {
/**
*
* @param orderList
* @param userId
* @return
* @throws Exception
*/
public List<LoanByUserView> findAllLoansByUserId(String orderList, String userId) throws Exception {
try {
List<ModelParameter> parameters = new ArrayList<>();
/**
*
* @param orderList
* @param userId
* @return
* @throws Exception
*/
public List<LoanByUserView> findAllLoansByUserId(String orderList, String userId) throws Exception {
try {
List<ModelParameter> parameters = new ArrayList<>();
boolean isByOrderInList = PreferenceValue.ORDER_IN_LIST.toString().equals(orderList);
boolean isByOrderInList = PreferenceValue.ORDER_IN_LIST.toString().equals(orderList);
parameters.add(new ModelParameter(LoanByUserViewCfg.FIELD_USER_ID, userId));
parameters.add(new ModelParameter(LoanByUserViewCfg.FIELD_USER_ID, userId));
return loanByUserViewRepository
.findAllLoansByUserId(
isByOrderInList
? LoanByUserViewCfg.QUERY_FIND_ALL_LOAN_BY_USER_ID_BY_ORDER_LIST
: LoanByUserViewCfg.QUERY_FIND_ALL_LOAN_BY_USER_ID_BY_CUSTOMER_NAME,
parameters
);
} catch (Exception e) {
logger.error("findAllLoansByUserId", e);
throw e;
}
}
return loanByUserViewRepository
.findAllLoansByUserId(
isByOrderInList
? LoanByUserViewCfg.QUERY_FIND_ALL_LOAN_BY_USER_ID_BY_ORDER_LIST
: LoanByUserViewCfg.QUERY_FIND_ALL_LOAN_BY_USER_ID_BY_CUSTOMER_NAME,
parameters
);
} catch (Exception e) {
logger.error("findAllLoansByUserId", e);
throw e;
}
}
private static final long serialVersionUID = -6689182942800786108L;
final Logger logger = LogManager.getLogger(CustomerController.class);
/**
*
* @param idRoute
* @return
* @throws Exception
*/
public List<CustomerWithoutRenovationView> findAllNonRenewingCustomersByRuteId(String idRoute) throws Exception {
try {
List<ModelParameter> parameters = new ArrayList<>();
private final LoanByUserViewRepository loanByUserViewRepository;
parameters.add(new ModelParameter(CustomerWithoutRenovationViewCfg.FIELD_RUTE_ID, idRoute));
public CustomerController() {
this.loanByUserViewRepository = new LoanByUserViewRepository();
}
return customerWithoutRenovationViewRepository
.nonRenewingCustomersByRuteId(
CustomerWithoutRenovationViewCfg.QUERY_FIND_ALL_UNRENEWED_CUSTOMERS_BY_ROUTE,
parameters
);
} catch (Exception e) {
logger.error("findAllLoansByUserId", e);
throw e;
}
}
private static final long serialVersionUID = -6689182942800786108L;
final Logger logger = LogManager.getLogger(CustomerController.class);
private final LoanByUserViewRepository loanByUserViewRepository;
private final CustomerWithoutRenovationViewRepository customerWithoutRenovationViewRepository;
public CustomerController() {
this.loanByUserViewRepository = new LoanByUserViewRepository();
this.customerWithoutRenovationViewRepository = new CustomerWithoutRenovationViewRepository();
}
}

View File

@ -0,0 +1,54 @@
/*
* Arrebol Consultancy copyright.
*
* This code belongs to Arrebol Consultancy
* its use, redistribution or modification are prohibited
* without written authorization from Arrebol Consultancy.
*/
package com.arrebol.apc.controller.mobile.repository.views;
import com.arrebol.apc.controller.mobile.repository.GenericRepository;
import com.arrebol.apc.model.ModelParameter;
import com.arrebol.apc.model.views.CustomerWithoutRenovationView;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/**
*
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
*/
public class CustomerWithoutRenovationViewRepository extends GenericRepository implements Serializable {
/**
*
* @param xmlQuery
* @param parameters
* @return
* @throws Exception
*/
public List<CustomerWithoutRenovationView> nonRenewingCustomersByRuteId(String xmlQuery, List<ModelParameter> parameters) throws Exception {
logger.debug("nonRenewingCustomersByRuteId");
List<CustomerWithoutRenovationView> results = new ArrayList<>();
try {
results = createNamedQueryResultList(
CustomerWithoutRenovationView.class,
xmlQuery,
parameters
);
} catch (Exception e) {
logger.error("nonRenewingCustomersByRuteId", e);
throw e;
}
return results;
}
private static final long serialVersionUID = 5669198954766725476L;
final Logger logger = LogManager.getLogger(CustomerWithoutRenovationViewRepository.class);
}

View File

@ -220,6 +220,7 @@
<mapping resource="com/arrebol/apc/model/queries/mobile/views/loan.in.pending.status.to.delivery.view.hbm.xml" />
<mapping resource="com/arrebol/apc/model/queries/loan/loan.employee.hbm.xml" />
<mapping resource="com/arrebol/apc/model/queries/mobile/views/current.customer.by.loan.view.hbm.xml" />
<mapping resource="com/arrebol/apc/model/queries/mobile/views/customer.without.renovation.view.queries.hbm.xml" />
<mapping resource="com/arrebol/apc/model/queries/mobile/views/availables.owners.view.hbm.xml" />
<mapping resource="com/arrebol/apc/model/queries/mobile/reports/user.week.report.hbm.xml" />
<mapping resource="com/arrebol/apc/model/queries/mobile/gasoline/gasoline.hbm.xml" />

View File

@ -216,6 +216,7 @@
<mapping resource="com/arrebol/apc/model/queries/mobile/views/loan.in.pending.status.to.delivery.view.hbm.xml" />
<mapping resource="com/arrebol/apc/model/queries/loan/loan.employee.hbm.xml" />
<mapping resource="com/arrebol/apc/model/queries/mobile/views/current.customer.by.loan.view.hbm.xml" />
<mapping resource="com/arrebol/apc/model/queries/mobile/views/customer.without.renovation.view.queries.hbm.xml" />
<mapping resource="com/arrebol/apc/model/queries/mobile/views/availables.owners.view.hbm.xml" />
<mapping resource="com/arrebol/apc/model/queries/mobile/reports/user.week.report.hbm.xml" />
<mapping resource="com/arrebol/apc/model/queries/mobile/gasoline/gasoline.hbm.xml" />

View File

@ -80,8 +80,8 @@
<id>Localhost</id>
<properties>
<hibernate.connection.url>jdbc:mysql://localhost:3306/apo_pro_com_april_ten?serverTimezone=GMT-5</hibernate.connection.url>
<hibernate.connection.username>apoprocomlocalhost</hibernate.connection.username>
<hibernate.connection.password>Yj$2Da0z!</hibernate.connection.password>
<hibernate.connection.username>root</hibernate.connection.username>
<hibernate.connection.password>root</hibernate.connection.password>
<hibernate.connection.min_size>10</hibernate.connection.min_size>
<hibernate.connection.max_size>40</hibernate.connection.max_size>
<hibernate.connection.timeout>1800</hibernate.connection.timeout>

View File

@ -0,0 +1,19 @@
/*
* Arrebol Consultancy copyright.
*
* This code belongs to Arrebol Consultancy
* its use, redistribution or modification are prohibited
* without written authorization from Arrebol Consultancy.
*/
package com.arrebol.apc.model.core.constance;
/**
*
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
*/
public interface CustomerWithoutRenovationViewCfg extends GenericCfg {
String QUERY_FIND_ALL_UNRENEWED_CUSTOMERS_BY_ROUTE = "findAllNonRenewingCustomersByRuteIdList";
String FIELD_RUTE_ID = "idRoute";
}

View File

@ -0,0 +1,137 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package com.arrebol.apc.model.views;
import java.io.Serializable;
import java.util.Date;
/**
*
* @author Oscar
*/
public class CustomerWithoutRenovationSimpleDTO implements Serializable {
private static final long serialVersionUID = 1L;
private String personName;
private Date lastLoan;
private String amountPaid;
private String amountToPay;
private String saldoInsoluto;
private String actionNumber;
private String numFee;
private String addressHome;
private String addressBusiness;
private String companyName;
private String strPaymentDate;
// Constructor
public CustomerWithoutRenovationSimpleDTO() {
}
// Constructor desde entidad
public CustomerWithoutRenovationSimpleDTO(CustomerWithoutRenovationView entity) {
this.personName = entity.getPersonName();
this.lastLoan = entity.getLastLoan();
this.amountPaid = entity.getAmountPaid();
this.amountToPay = entity.getAmountToPay();
this.saldoInsoluto = entity.getSaldoInsoluto();
this.actionNumber = entity.getActionNumber();
this.numFee = entity.getNumFee();
this.addressHome = entity.getAddressHome();
this.addressBusiness = entity.getAddressBusiness();
this.companyName = entity.getCompanyName();
this.strPaymentDate = entity.getStrPaymentDate();
}
public String getPersonName() {
return personName;
}
public void setPersonName(String personName) {
this.personName = personName;
}
public Date getLastLoan() {
return lastLoan;
}
public void setLastLoan(Date lastLoan) {
this.lastLoan = lastLoan;
}
public String getAmountPaid() {
return amountPaid;
}
public void setAmountPaid(String amountPaid) {
this.amountPaid = amountPaid;
}
public String getAmountToPay() {
return amountToPay;
}
public void setAmountToPay(String amountToPay) {
this.amountToPay = amountToPay;
}
public String getSaldoInsoluto() {
return saldoInsoluto;
}
public void setSaldoInsoluto(String saldoInsoluto) {
this.saldoInsoluto = saldoInsoluto;
}
public String getActionNumber() {
return actionNumber;
}
public void setActionNumber(String actionNumber) {
this.actionNumber = actionNumber;
}
public String getNumFee() {
return numFee;
}
public void setNumFee(String numFee) {
this.numFee = numFee;
}
public String getAddressHome() {
return addressHome;
}
public void setAddressHome(String addressHome) {
this.addressHome = addressHome;
}
public String getAddressBusiness() {
return addressBusiness;
}
public void setAddressBusiness(String addressBusiness) {
this.addressBusiness = addressBusiness;
}
public String getCompanyName() {
return companyName;
}
public void setCompanyName(String companyName) {
this.companyName = companyName;
}
public String getStrPaymentDate() {
return strPaymentDate;
}
public void setStrPaymentDate(String strPaymentDate) {
this.strPaymentDate = strPaymentDate;
}
}

View File

@ -1,8 +1,8 @@
/*
* Arrebol Consultancy copyright.
*
*
* This code belongs to Arrebol Consultancy
* its use, redistribution or modification are prohibited
* its use, redistribution or modification are prohibited
* without written authorization from Arrebol Consultancy.
*/
package com.arrebol.apc.model.views;
@ -30,197 +30,203 @@ import org.hibernate.annotations.Immutable;
@Table(name = "APC_CUSTOMERS_WITHOUT_RENOVATION_VIEW")
public class CustomerWithoutRenovationView implements Serializable {
private static final long serialVersionUID = 3731003393000465083L;
private static final long serialVersionUID = 3731003393000465083L;
@Id
@Column(name = "id", length = 36)
private String id;
@Id
@Column(name = "id", length = 36)
private String id;
@Column(name = "available_person")
private String personName;
@Column(name = "available_person")
private String personName;
@Column(name = "route_name")
private String routeName;
@Column(name = "route_name")
private String routeName;
@Column(name = "last_loan")
@Temporal(javax.persistence.TemporalType.DATE)
private Date lastLoan;
@Column(name = "amount_paid")
private String amountPaid;
@Column(name = "amount_to_pay")
private String amountToPay;
@Column(name = "saldo_insoluto")
private String saldoInsoluto;
@Column(name = "id_route")
private String idRoute;
@Column(name = "action_number")
private String actionNumber;
@Column(name = "num_fee")
private String numFee;
@Column(name = "address_home")
private String addressHome;
@Column(name = "address_business")
private String addressBusiness;
@Column(name = "company_name")
private String companyName;
@Column(name = "last_loan")
@Temporal(javax.persistence.TemporalType.DATE)
private Date lastLoan;
@ManyToOne(fetch = FetchType.LAZY, optional = false)
@JoinColumn(
name = "id_office",
referencedColumnName = "id",
nullable = false
)
private Office office;
@Column(name = "amount_paid")
private String amountPaid;
@Column(name = "str_payment_date", length = 22)
private String strPaymentDate;
@Column(name = "amount_to_pay")
private String amountToPay;
public String getId() {
return id;
}
@Column(name = "saldo_insoluto")
private String saldoInsoluto;
public void setId(String id) {
this.id = id;
}
@Column(name = "action_number")
private String actionNumber;
public String getPersonName() {
return personName;
}
@Column(name = "num_fee")
private String numFee;
public void setPersonName(String personName) {
this.personName = personName;
}
@Column(name = "address_home")
private String addressHome;
public String getRouteName() {
return routeName;
}
@Column(name = "address_business")
private String addressBusiness;
public void setRouteName(String routeName) {
this.routeName = routeName;
}
@Column(name = "company_name")
private String companyName;
public Date getLastLoan() {
return lastLoan;
}
@ManyToOne(fetch = FetchType.LAZY, optional = false)
@JoinColumn(
name = "id_office",
referencedColumnName = "id",
nullable = false
)
private Office office;
public void setLastLoan(Date lastLoan) {
this.lastLoan = lastLoan;
}
@Column(name = "str_payment_date", length = 22)
private String strPaymentDate;
public Office getOffice() {
return office;
}
public String getId() {
return id;
}
public void setOffice(Office office) {
this.office = office;
}
public void setId(String id) {
this.id = id;
}
public String getStrPaymentDate() {
return strPaymentDate;
}
public String getPersonName() {
return personName;
}
public void setStrPaymentDate(String strPaymentDate) {
this.strPaymentDate = strPaymentDate;
}
public void setPersonName(String personName) {
this.personName = personName;
}
public String getAmountPaid() {
return amountPaid;
}
public String getRouteName() {
return routeName;
}
public void setAmountPaid(String amountPaid) {
this.amountPaid = amountPaid;
}
public void setRouteName(String routeName) {
this.routeName = routeName;
}
public String getAmountToPay() {
return amountToPay;
}
public Date getLastLoan() {
return lastLoan;
}
public void setAmountToPay(String amountToPay) {
this.amountToPay = amountToPay;
}
public void setLastLoan(Date lastLoan) {
this.lastLoan = lastLoan;
}
public String getSaldoInsoluto() {
return saldoInsoluto;
}
public Office getOffice() {
return office;
}
public void setSaldoInsoluto(String saldoInsoluto) {
this.saldoInsoluto = saldoInsoluto;
}
public void setOffice(Office office) {
this.office = office;
}
public String getActionNumber() {
return actionNumber;
}
public String getStrPaymentDate() {
return strPaymentDate;
}
public void setActionNumber(String actionNumber) {
this.actionNumber = actionNumber;
}
public void setStrPaymentDate(String strPaymentDate) {
this.strPaymentDate = strPaymentDate;
}
public String getNumFee() {
return numFee;
}
public String getAmountPaid() {
return amountPaid;
}
public void setNumFee(String numFee) {
this.numFee = numFee;
}
public void setAmountPaid(String amountPaid) {
this.amountPaid = amountPaid;
}
public String getAddressHome() {
return addressHome;
}
public String getAmountToPay() {
return amountToPay;
}
public void setAddressHome(String addressHome) {
this.addressHome = addressHome;
}
public void setAmountToPay(String amountToPay) {
this.amountToPay = amountToPay;
}
public String getAddressBusiness() {
return addressBusiness;
}
public String getSaldoInsoluto() {
return saldoInsoluto;
}
public void setAddressBusiness(String addressBusiness) {
this.addressBusiness = addressBusiness;
}
public void setSaldoInsoluto(String saldoInsoluto) {
this.saldoInsoluto = saldoInsoluto;
}
public String getCompanyName() {
return companyName;
}
public String getActionNumber() {
return actionNumber;
}
public void setCompanyName(String companyName) {
this.companyName = companyName;
}
public void setActionNumber(String actionNumber) {
this.actionNumber = actionNumber;
}
@Override
public int hashCode() {
int hash = 7;
hash = 61 * hash + Objects.hashCode(this.id);
return hash;
}
public String getNumFee() {
return numFee;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final CustomerWithoutRenovationView other = (CustomerWithoutRenovationView) obj;
if (!Objects.equals(this.id, other.id)) {
return false;
}
return true;
}
public void setNumFee(String numFee) {
this.numFee = numFee;
}
public String getAddressHome() {
return addressHome;
}
public void setAddressHome(String addressHome) {
this.addressHome = addressHome;
}
public String getAddressBusiness() {
return addressBusiness;
}
public void setAddressBusiness(String addressBusiness) {
this.addressBusiness = addressBusiness;
}
public String getCompanyName() {
return companyName;
}
public void setCompanyName(String companyName) {
this.companyName = companyName;
}
public String getIdRoute() {
return idRoute;
}
public void setIdRoute(String idRoute) {
this.idRoute = idRoute;
}
@Override
public int hashCode() {
int hash = 7;
hash = 61 * hash + Objects.hashCode(this.id);
return hash;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final CustomerWithoutRenovationView other = (CustomerWithoutRenovationView) obj;
if (!Objects.equals(this.id, other.id)) {
return false;
}
return true;
}
}

View File

@ -222,6 +222,7 @@
<mapping resource="com/arrebol/apc/model/queries/mobile/views/loan.in.pending.status.to.delivery.view.hbm.xml" />
<mapping resource="com/arrebol/apc/model/queries/loan/loan.employee.hbm.xml" />
<mapping resource="com/arrebol/apc/model/queries/mobile/views/current.customer.by.loan.view.hbm.xml" />
<mapping resource="com/arrebol/apc/model/queries/mobile/views/customer.without.renovation.view.queries.hbm.xml" />
<mapping resource="com/arrebol/apc/model/queries/mobile/views/availables.owners.view.hbm.xml" />
<mapping resource="com/arrebol/apc/model/queries/mobile/reports/user.week.report.hbm.xml" />
<mapping resource="com/arrebol/apc/model/queries/mobile/gasoline/gasoline.hbm.xml" />

View File

@ -0,0 +1,17 @@
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"https://hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<query name="findAllNonRenewingCustomersByRuteIdList">
<![CDATA[
SELECT
view
FROM CustomerWithoutRenovationView view
WHERE
idRoute = :idRoute
ORDER BY personName DESC
]]>
</query>
</hibernate-mapping>

View File

@ -140,8 +140,8 @@
<id>Localhost</id>
<properties>
<hibernate.connection.url>jdbc:mysql://localhost:3306/apo_pro_com_april_ten?serverTimezone=GMT-5</hibernate.connection.url>
<hibernate.connection.username>apoprocomlocalhost</hibernate.connection.username>
<hibernate.connection.password>Yj$2Da0z!</hibernate.connection.password>
<hibernate.connection.username>root</hibernate.connection.username>
<hibernate.connection.password>root</hibernate.connection.password>
</properties>
</profile>
<profile>

View File

@ -206,11 +206,11 @@
</properties>
</profile>
<profile>
<id>Localhost-Mobile-APP</id>
<id>Localhost</id>
<properties>
<hibernate.connection.url>jdbc:mysql://localhost:3306/apo_pro_com_april_ten?serverTimezone=GMT-5</hibernate.connection.url>
<hibernate.connection.username>apoprocommobilelocalhost</hibernate.connection.username>
<hibernate.connection.password>0Ps$6%q8</hibernate.connection.password>
<hibernate.connection.username>root</hibernate.connection.username>
<hibernate.connection.password>root</hibernate.connection.password>
</properties>
</profile>
<profile>

View File

@ -1,20 +1,25 @@
/*
* Arrebol Consultancy copyright.
*
*
* This code belongs to Arrebol Consultancy
* its use, redistribution or modification are prohibited
* its use, redistribution or modification are prohibited
* without written authorization from Arrebol Consultancy.
*/
package com.arrebol.apc.ws.customer;
import com.arrebol.apc.controller.mobile.controller.customer.CustomerController;
import com.arrebol.apc.model.views.CustomerWithoutRenovationSimpleDTO;
import com.arrebol.apc.model.views.CustomerWithoutRenovationView;
import com.arrebol.apc.model.views.LoanByUserView;
import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;
import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.GenericEntity;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@ -28,32 +33,59 @@ import org.apache.logging.log4j.Logger;
@Path("customer")
public class CustomerWS implements Serializable {
private static final long serialVersionUID = -5280895557294295716L;
private static final long serialVersionUID = -5280895557294295716L;
@POST
@Path("list")
@Produces(MediaType.APPLICATION_JSON)
public Response findAllLoansByUserId(@FormParam("orderList") String orderList, @FormParam("userId") String userId) {
logger.debug("findAllLoansByUserId");
@POST
@Path("list")
@Produces(MediaType.APPLICATION_JSON)
public Response findAllLoansByUserId(@FormParam("orderList") String orderList, @FormParam("userId") String userId) {
logger.debug("findAllLoansByUserId");
Response response;
try {
GenericEntity<List<LoanByUserView>> list = new GenericEntity<List<LoanByUserView>>(controller.findAllLoansByUserId(orderList, userId)) {
};
Response response;
try {
GenericEntity<List<LoanByUserView>> list = new GenericEntity<List<LoanByUserView>>(controller.findAllLoansByUserId(orderList, userId)) {
};
response = Response.ok(list).build();
} catch (Exception e) {
logger.error("findAllLoansByUserId", e);
response = Response.status(Response.Status.NOT_ACCEPTABLE).build();
}
return response;
}
response = Response.ok(list).build();
} catch (Exception e) {
logger.error("findAllLoansByUserId", e);
response = Response.status(Response.Status.NOT_ACCEPTABLE).build();
}
return response;
}
final Logger logger = LogManager.getLogger(CustomerWS.class);
private final CustomerController controller;
@GET
@Path("nonRenewingCustomersByRuteId")
@Produces(MediaType.APPLICATION_JSON)
public Response findAllNonRenewingCustomersByRuteId(@QueryParam("idRoute") String idRoute) {
logger.debug("findAllNonRenewingCustomersByRuteId");
public CustomerWS() {
this.controller = new CustomerController();
}
Response response;
try {
List<CustomerWithoutRenovationView> originalList = controller.findAllNonRenewingCustomersByRuteId(idRoute);
// Convertir a DTOs
List<CustomerWithoutRenovationSimpleDTO> simplifiedList = originalList.stream()
.map(CustomerWithoutRenovationSimpleDTO::new)
.collect(Collectors.toList());
GenericEntity<List<CustomerWithoutRenovationSimpleDTO>> list
= new GenericEntity<List<CustomerWithoutRenovationSimpleDTO>>(simplifiedList) {
};
response = Response.ok(list).build();
} catch (Exception e) {
logger.error("findAllNonRenewingCustomersByRuteId", e);
response = Response.status(Response.Status.NOT_ACCEPTABLE).build();
}
return response;
}
final Logger logger = LogManager.getLogger(CustomerWS.class);
private final CustomerController controller;
public CustomerWS() {
this.controller = new CustomerController();
}
}

View File

@ -216,6 +216,7 @@
<mapping resource="com/arrebol/apc/model/queries/mobile/views/loan.in.pending.status.to.delivery.view.hbm.xml" />
<mapping resource="com/arrebol/apc/model/queries/loan/loan.employee.hbm.xml" />
<mapping resource="com/arrebol/apc/model/queries/mobile/views/current.customer.by.loan.view.hbm.xml" />
<mapping resource="com/arrebol/apc/model/queries/mobile/views/customer.without.renovation.view.queries.hbm.xml" />
<mapping resource="com/arrebol/apc/model/queries/mobile/views/availables.owners.view.hbm.xml" />
<mapping resource="com/arrebol/apc/model/queries/mobile/reports/user.week.report.hbm.xml" />
<mapping resource="com/arrebol/apc/model/queries/mobile/gasoline/gasoline.hbm.xml" />