- MOSTRAR POR RUTA EN EL TELEFONO DE RUTA LOS CLIENTES SIN RENOVAR
This commit is contained in:
parent
25fde10e97
commit
6ec0f569e1
@ -7,10 +7,13 @@
|
||||
*/
|
||||
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;
|
||||
@ -52,12 +55,37 @@ public class CustomerController implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param idRoute
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<CustomerWithoutRenovationView> findAllNonRenewingCustomersByRuteId(String idRoute) throws Exception {
|
||||
try {
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(CustomerWithoutRenovationViewCfg.FIELD_RUTE_ID, idRoute));
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
}
|
@ -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" />
|
||||
|
@ -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" />
|
||||
|
@ -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>
|
||||
|
@ -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";
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
@ -42,6 +42,9 @@ public class CustomerWithoutRenovationView implements Serializable {
|
||||
@Column(name = "route_name")
|
||||
private String routeName;
|
||||
|
||||
@Column(name = "id_route")
|
||||
private String idRoute;
|
||||
|
||||
@Column(name = "last_loan")
|
||||
@Temporal(javax.persistence.TemporalType.DATE)
|
||||
private Date lastLoan;
|
||||
@ -70,9 +73,6 @@ public class CustomerWithoutRenovationView implements Serializable {
|
||||
@Column(name = "company_name")
|
||||
private String companyName;
|
||||
|
||||
|
||||
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY, optional = false)
|
||||
@JoinColumn(
|
||||
name = "id_office",
|
||||
@ -196,7 +196,13 @@ public class CustomerWithoutRenovationView implements Serializable {
|
||||
this.companyName = companyName;
|
||||
}
|
||||
|
||||
public String getIdRoute() {
|
||||
return idRoute;
|
||||
}
|
||||
|
||||
public void setIdRoute(String idRoute) {
|
||||
this.idRoute = idRoute;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
|
@ -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" />
|
||||
|
@ -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>
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -8,13 +8,18 @@
|
||||
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;
|
||||
@ -49,6 +54,33 @@ public class CustomerWS implements Serializable {
|
||||
return response;
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("nonRenewingCustomersByRuteId")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Response findAllNonRenewingCustomersByRuteId(@QueryParam("idRoute") String idRoute) {
|
||||
logger.debug("findAllNonRenewingCustomersByRuteId");
|
||||
|
||||
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;
|
||||
|
||||
|
@ -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" />
|
||||
|
Loading…
Reference in New Issue
Block a user