- CAPTURA DE LA LOCALIZACIÓN DE LOS PAGOS Y ACTUALIZACIÓN DEL WS PARA LA CAPTURA Y RETORNO DE LOS NUEVOS DATOS 

- CARGADO DE LISTADO DE LAS VENTAS APROBADAS PARA LA VISUALIZACIÓN DE LA LOCALIZACIÓN DE LA VENTA
This commit is contained in:
Brayan.Gonzalez 2025-08-06 19:08:07 -06:00
parent 0d10bf21e2
commit 7ae73a230e
13 changed files with 806 additions and 551 deletions

View File

@ -500,7 +500,9 @@ public class LoanController implements Serializable {
newAmountJaxb.getUserId(),
date,
newAmountJaxb.getComments(),
newAmountJaxb.getFolio()
newAmountJaxb.getFolio(),
newAmountJaxb.getLongitud(),
newAmountJaxb.getLatitud()
);
BigDecimal newAmountPaid, newAmountToPay;
@ -577,7 +579,9 @@ public class LoanController implements Serializable {
transfer.getComments(),
null == transfer.getTransferReference() || transfer.getTransferReference().trim().equals("") ? "Asesor no guardo la referencia de la transferencia. Rechar directamente o solicitar con el administrador la aclaración." : transfer.getTransferReference(),
TransferStatus.PENDING,
transfer.getFolio()
transfer.getFolio(),
transfer.getLongitud(),
transfer.getLatitud()
);
BigDecimal newAmountPaid = loan.getAmountPaid().add(amountWithoutIVA);

View File

@ -151,7 +151,9 @@ public class LoanApprovedDetailViewRepository extends GenericRepository implemen
tuple.get("fullNameCliente", String.class),
tuple.get("numeroCuenta", String.class),
tuple.get("fullNameCrobrador", String.class),
tuple.get("folio", String.class)
tuple.get("folio", String.class),
tuple.get("longitud", String.class),
tuple.get("latitud", String.class)
);
results.add(detail);

View File

@ -42,6 +42,7 @@ public interface LoanCfg extends GenericCfg {
String QUERY_SELECT_LOAN_ID_BY_CUSTOMER_IN_STATUSES = "selectLoanIdByCustomerInStatuses";
String QUERY_FIND_LOAN_BY_STATUS_PENDING = "findLoansByStatusPending";
String QUERY_FIND_LOAN_BY_STATUS_APPROVED = "findLoansByStatusApproved";
String QUERY_FIND_ALL_LOANS = "findAllLoans";
String QUERY_FIND_ALL_LOANS_VIEW = "findAllLoansView";
String QUERY_FIND_ALL_LOANS_VIEW_BY_START_AND_END_DATE = "findAllLoansViewByStartAndEndDate";

View File

@ -86,6 +86,12 @@ public class LoanDetails implements Serializable {
@Column(name = "folio", length = 150)
private String folio;
@Column(name = "longitud", length = 150)
private String longitud;
@Column(name = "latitud", length = 150)
private String latitud;
@Enumerated(EnumType.STRING)
@Column(name = "fee_status")
private FeeStatus feeStatus;
@ -209,8 +215,10 @@ public class LoanDetails implements Serializable {
* @param createdOn
* @param comments
* @param folio
* @param longitud
* @param latitud
*/
public LoanDetails(Loan loan, User user, PeopleType peopleType, BigDecimal paymentAmount, Integer referenceNumber, LoanDetailsType loanDetailsType, String createdBy, Date createdOn, String comments, String folio) {
public LoanDetails(Loan loan, User user, PeopleType peopleType, BigDecimal paymentAmount, Integer referenceNumber, LoanDetailsType loanDetailsType, String createdBy, Date createdOn, String comments, String folio, String longitud, String latitud) {
this.loan = loan;
this.user = user;
this.peopleType = peopleType;
@ -221,6 +229,8 @@ public class LoanDetails implements Serializable {
this.createdOn = createdOn;
this.comments = comments;
this.folio = folio;
this.longitud = longitud;
this.latitud = latitud;
}
/**
@ -265,8 +275,10 @@ public class LoanDetails implements Serializable {
* @param transferNumber
* @param transferStatus
* @param folio
* @param longitud
* @param latitud
*/
public LoanDetails(Loan loan, User user, PeopleType peopleType, BigDecimal paymentAmount, Integer referenceNumber, LoanDetailsType loanDetailsType, String createdBy, Date createdOn, String comments, String transferNumber, TransferStatus transferStatus, String folio) {
public LoanDetails(Loan loan, User user, PeopleType peopleType, BigDecimal paymentAmount, Integer referenceNumber, LoanDetailsType loanDetailsType, String createdBy, Date createdOn, String comments, String transferNumber, TransferStatus transferStatus, String folio, String longitud, String latitud) {
this.loan = loan;
this.user = user;
this.peopleType = peopleType;
@ -279,6 +291,8 @@ public class LoanDetails implements Serializable {
this.transferNumber = transferNumber;
this.transferStatus = transferStatus;
this.folio = folio;
this.longitud = longitud;
this.latitud = latitud;
}
public String getId() {
@ -405,6 +419,22 @@ public class LoanDetails implements Serializable {
this.folio = folio;
}
public String getLongitud() {
return longitud;
}
public void setLongitud(String longitud) {
this.longitud = longitud;
}
public String getLatitud() {
return latitud;
}
public void setLatitud(String latitud) {
this.latitud = latitud;
}
@Override
public String toString() {
return "LoanDetails{" + "referenceNumber=" + referenceNumber + ", comments=" + comments + ", createdBy=" + createdBy + '}';

View File

@ -29,6 +29,8 @@ public class LoanDetailJaxb {
private String numeroCuenta;
private String fullNameCrobrador;
private String folio;
private String longitud;
private String latitud;
public LoanDetailJaxb() {
}
@ -45,8 +47,11 @@ public class LoanDetailJaxb {
* @param fullNameCliente
* @param numeroCuenta
* @param fullNameCrobrador
* @param folio
* @param longitud
* @param latitud
*/
public LoanDetailJaxb(String paymentDate, double paymentOfDay, double toPay, String comment, String paymentType, String fullNameVendedor, String fullNameCliente, String numeroCuenta, String fullNameCrobrador, String folio) {
public LoanDetailJaxb(String paymentDate, double paymentOfDay, double toPay, String comment, String paymentType, String fullNameVendedor, String fullNameCliente, String numeroCuenta, String fullNameCrobrador, String folio, String longitud, String latitud) {
this.paymentDate = paymentDate;
this.paymentOfDay = paymentOfDay;
this.toPay = toPay;
@ -57,6 +62,8 @@ public class LoanDetailJaxb {
this.numeroCuenta = numeroCuenta;
this.fullNameCrobrador = fullNameCrobrador;
this.folio = folio;
this.longitud = longitud;
this.latitud = latitud;
}
/**
@ -191,6 +198,24 @@ public class LoanDetailJaxb {
this.folio = folio;
}
@XmlElement(name = "longitud")
public String getLongitud() {
return longitud;
}
public void setLongitud(String longitud) {
this.longitud = longitud;
}
@XmlElement(name = "latitud")
public String getLatitud() {
return latitud;
}
public void setLatitud(String latitud) {
this.latitud = latitud;
}
@Override
public String toString() {
return "LoanDetailJaxb{" + "paymentDate=" + paymentDate + ", paymentOfDay=" + paymentOfDay + ", toPay=" + toPay + ", payment=" + payment + '}';

View File

@ -28,6 +28,8 @@ public class NewAmountJaxb {
private String comments;
private Boolean manager;
private String folio;
private String longitud;
private String latitud;
public NewAmountJaxb() {
}
@ -125,4 +127,22 @@ public class NewAmountJaxb {
this.folio = folio;
}
@XmlAttribute(name = "longitud")
public String getLongitud() {
return longitud;
}
public void setLongitud(String longitud) {
this.longitud = longitud;
}
@XmlAttribute(name = "latitud")
public String getLatitud() {
return latitud;
}
public void setLatitud(String latitud) {
this.latitud = latitud;
}
}

View File

@ -26,6 +26,8 @@ public class NewTransferAccountJaxb {
private String transferReference;
private Boolean manager;
private String folio;
private String longitud;
private String latitud;
public NewTransferAccountJaxb() {
}
@ -104,4 +106,23 @@ public class NewTransferAccountJaxb {
public void setFolio(String folio) {
this.folio = folio;
}
@XmlAttribute(name = "longitud")
public String getLongitud() {
return longitud;
}
public void setLongitud(String longitud) {
this.longitud = longitud;
}
@XmlAttribute(name = "latitud")
public String getLatitud() {
return latitud;
}
public void setLatitud(String latitud) {
this.latitud = latitud;
}
}

View File

@ -32,19 +32,21 @@
lt.paymentTotal AS amountToPay,
ld.comments AS comments,
CONCAT(per.firstName, ' ',
IFNULL(CONCAT(per.secondName, ' '), ''),
CASE WHEN per.secondName IS NULL THEN '' ELSE CONCAT(per.secondName, ' ') END,
per.lastName, ' ',
per.middleName) AS fullNameVendedor,
CONCAT(peo.firstName, ' ',
IFNULL(CONCAT(peo.secondName, ' '), ''),
CASE WHEN peo.secondName IS NULL THEN '' ELSE CONCAT(peo.secondName, ' ') END,
peo.lastName, ' ',
IFNULL(peo.middleName, '')) AS fullNameCliente,
CONCAT(IFNULL(peo.contrato, ''), ' - ', IFNULL(rut.route, '')) AS numeroCuenta,
COALESCE(peo.middleName, '')) AS fullNameCliente,
CONCAT(COALESCE(peo.contrato, ''), ' - ', COALESCE(rut.route, '')) AS numeroCuenta,
CONCAT(perv.firstName, ' ',
IFNULL(CONCAT(perv.secondName, ' '), ''),
CASE WHEN perv.secondName IS NULL THEN '' ELSE CONCAT(perv.secondName, ' ') END,
perv.lastName, ' ',
perv.middleName) AS fullNameCrobrador,
ld.folio AS folio
COALESCE(CAST(ld.folio AS string), '') AS folio,
COALESCE(CAST(ld.longitud AS string), '') AS longitud,
COALESCE(CAST(ld.latitud AS string), '') AS latitud
FROM
LoanDetails ld
INNER JOIN Loan l ON ld.loan = l.id
@ -72,19 +74,21 @@
lt.paymentTotal AS amountToPay,
ld.comments AS comments,
CONCAT(per.firstName, ' ',
IFNULL(CONCAT(per.secondName, ' '), ''),
CASE WHEN per.secondName IS NULL THEN '' ELSE CONCAT(per.secondName, ' ') END,
per.lastName, ' ',
per.middleName) AS fullNameVendedor,
CONCAT(peo.firstName, ' ',
IFNULL(CONCAT(peo.secondName, ' '), ''),
CASE WHEN peo.secondName IS NULL THEN '' ELSE CONCAT(peo.secondName, ' ') END,
peo.lastName, ' ',
IFNULL(peo.middleName, '')) AS fullNameCliente,
CONCAT(IFNULL(peo.contrato, ''), ' - ', IFNULL(rut.route, '')) AS numeroCuenta,
COALESCE(peo.middleName, '')) AS fullNameCliente,
CONCAT(COALESCE(peo.contrato, ''), ' - ', COALESCE(rut.route, '')) AS numeroCuenta,
CONCAT(perv.firstName, ' ',
IFNULL(CONCAT(perv.secondName, ' '), ''),
CASE WHEN perv.secondName IS NULL THEN '' ELSE CONCAT(perv.secondName, ' ') END,
perv.lastName, ' ',
perv.middleName) AS fullNameCrobrador,
ld.folio AS folio
COALESCE(CAST(ld.folio AS string), '') AS folio,
COALESCE(CAST(ld.longitud AS string), '') AS longitud,
COALESCE(CAST(ld.latitud AS string), '') AS latitud
FROM
LoanDetails ld
INNER JOIN Loan l ON ld.loan = l.id

View File

@ -148,6 +148,20 @@
]]>
</query>
<query name="findLoansByStatusApproved">
<![CDATA[
SELECT
l
FROM
Loan l
WHERE
l.loanStatus = 'APPROVED'
AND l.endorsement.office.id = :id
ORDER BY
l.createdOn
]]>
</query>
<query name="findAllLoans">
<![CDATA[
SELECT

View File

@ -70,6 +70,10 @@ import org.primefaces.model.LazyDataModel;
import org.primefaces.model.SortOrder;
import org.primefaces.model.chart.BarChartModel;
import org.primefaces.model.chart.PieChartModel;
import org.primefaces.model.map.DefaultMapModel;
import org.primefaces.model.map.LatLng;
import org.primefaces.model.map.MapModel;
import org.primefaces.model.map.Marker;
/**
*
@ -79,6 +83,31 @@ import org.primefaces.model.chart.PieChartModel;
@ViewScoped
public class DashboardBean extends GenericBean implements Serializable {
private void cargarMapaDeVentas() {
try {
setMapaDeVentas(new DefaultMapModel());
List<Loan> ventas = getLoanCtrl().fillLoanByStatusApprovedDatatable(getLoggedUser().getOffice().getId());
for (Loan u : ventas) {
if (u.getLatitud() != null && u.getLongitud() != null) {
try {
double lat = Double.parseDouble(u.getLatitud().trim());
double lng = Double.parseDouble(u.getLongitud().trim());
if (lat >= -90 && lat <= 90 && lng >= -180 && lng <= 180) {
LatLng coord = new LatLng(lat, lng);
Marker marker = new Marker(coord, u.getLoanType().getLoanTypeName());
getMapaDeVentas().addOverlay(marker);
}
} catch (NumberFormatException e) {
System.err.println("Coordenadas inválidas para préstamo ID: " + u.getId());
}
}
}
} catch (Exception e) {
System.err.println("cargarMapaDeVentas(): " + e);
showMessage(FacesMessage.SEVERITY_WARN, "Error", "Ocurrió un error al tratar de cargar el mapa");
}
}
public String detailCustomer(String outcome) {
return outcome;
}
@ -1684,6 +1713,38 @@ public class DashboardBean extends GenericBean implements Serializable {
this.peopleCtrl = peopleCtrl;
}
public MapModel getMapaDeVentas() {
return mapaDeVentas;
}
public void setMapaDeVentas(MapModel mapaDeVentas) {
this.mapaDeVentas = mapaDeVentas;
}
public String getMapaUbicacionInicial() {
return mapaUbicacionInicial;
}
public void setMapaUbicacionInicial(String mapaUbicacionInicial) {
this.mapaUbicacionInicial = mapaUbicacionInicial;
}
public List<Loan> getVentasActivasList() {
return ventasActivasList;
}
public void setVentasActivasList(List<Loan> ventasActivasList) {
this.ventasActivasList = ventasActivasList;
}
public Loan getSelectedVenta() {
return selectedVenta;
}
public void setSelectedVenta(Loan selectedVenta) {
this.selectedVenta = selectedVenta;
}
@Inject
private CustomerWithoutRenovationViewService customerWithoutRenovationViewService;
@ -1740,6 +1801,7 @@ public class DashboardBean extends GenericBean implements Serializable {
private List<AdvanceUserDailyDetail> advancesDetail;
private List<Loan> loan;
private List<Loan> loanJuridical;
private List<Loan> ventasActivasList;
private List<LoanDetailZeroView> loanZero;
private List<LoanFinishedView> loanFinished;
private List<Loan> loanEndorsement;
@ -1754,16 +1816,19 @@ public class DashboardBean extends GenericBean implements Serializable {
private Loan selectedLoan;
private Loan selectedLoanJuridical;
private Loan selectedVenta;
private LoanDetailZeroView selectedLoanZero;
private LoanFinishedView selectedLoanFinished;
private Loan selectedLoanEndorsement;
private GenericValidationController genericValidateController;
private Date lastStableSmallBox;
private boolean stableSmallBoxToday;
//private boolean stableSmallBoxToday;
private String plantillaHTML;
private MapModel mapaDeVentas;
private String mapaUbicacionInicial;
@Inject
private CustomerService customerService;
@ -1823,6 +1888,9 @@ public class DashboardBean extends GenericBean implements Serializable {
getResumenLoans();
getLoansJuridical();
getLoansZero();
setVentasActivasList(getLoanCtrl().fillLoanByStatusApprovedDatatable(getLoggedUser().getOffice().getId()));
setMapaUbicacionInicial("20.6590175,105.2110526");
cargarMapaDeVentas();
}
public boolean getAction() {

View File

@ -34,7 +34,7 @@
<!--
Java Server Faces Application Listeners
-->
<listener>
<listener>
<listener-class>org.apache.webbeans.servlet.WebBeansConfigurationListener</listener-class>
</listener>
<listener>
@ -141,7 +141,7 @@
<role-name>system.employee</role-name>
</auth-constraint>
</security-constraint>
<security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>Views only available when logged has a USER CREATE grant</web-resource-name>
<url-pattern>/app/system/user/add/main.jsf</url-pattern>
@ -150,7 +150,7 @@
<role-name>system.user.create</role-name>
</auth-constraint>
</security-constraint>
<security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>Views only available when logged has a USER SETTINGS grant</web-resource-name>
<url-pattern>/app/system/user/setting/main.jsf</url-pattern>
@ -159,7 +159,7 @@
<role-name>system.user.admin</role-name>
</auth-constraint>
</security-constraint>
<security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>Views only available when logged has a USER ACCESS grant</web-resource-name>
<url-pattern>/app/system/user/access/main.jsf</url-pattern>
@ -178,7 +178,7 @@
</auth-constraint>
</security-constraint>
<!-- TBD -->
<!--security-constraint>
<!--security-constraint>
<web-resource-collection>
<web-resource-name>Views only available when logged has a logs grant</web-resource-name>
<url-pattern>.jsf</url-pattern>
@ -198,13 +198,13 @@
<security-role>
<role-name>system.employee</role-name>
</security-role>
<security-role>
<security-role>
<role-name>system.user.create</role-name>
</security-role>
<security-role>
<security-role>
<role-name>system.user.admin</role-name>
</security-role>
<security-role>
<security-role>
<role-name>system.user.access</role-name>
</security-role>
<security-role>

View File

@ -299,6 +299,58 @@
</div>
</div>
<div class="ui-g-12">
<div class="card">
<h2>Listado de ventas ver ubicación</h2>
<p:dataTable widgetVar="dtVentas" id="dtVentas" var="loan" draggableRows="true" draggableColumns="true" value="#{dashboardManager.ventasActivasList}"
style="margin-bottom:20px" reflow="true" rowsPerPageTemplate="5,10,25,50,100" emptyMessage="#{i18n['admin.loans.datatable.empty']}"
rowKey="#{loan.id}" selection="#{dashboardManager.selectedVenta}" editable="true" selectionMode="single" paginator="true"
rows="10" paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}">
<f:facet name="header">
<p:commandButton id="toggler" type="button" value="Columnas" style="float:left;" styleClass="amber-btn flat" icon="ui-icon-calendar"/>
<p:columnToggler datasource="dtVentas" trigger="toggler" />
<p:outputPanel>
<h:outputText value="#{i18n['general.search']}: " />
<p:inputText id="globalFilter" onkeyup="PF('dtVentas').filter()" style="width:150px;color: #000000;"/>
</p:outputPanel>
</f:facet>
<p:column headerText="Aval" sortBy="#{loan.endorsement.fullName}" filterBy="#{loan.endorsement.fullName}">
<h:outputText value="#{loan.endorsement.fullName}" />
</p:column>
<p:column headerText="Cliente" sortBy="#{loan.customer.fullName}" filterBy="#{loan.customer.fullName}">
<h:outputText value="#{loan.customer.fullName}" />
</p:column>
<p:column headerText="Producto" sortBy="#{loan.loanType.loanTypeName}" filterBy="#{loan.loanType.loanTypeName}">
<h:outputText value="#{loan.loanType.loanTypeName}" />
</p:column>
<p:column headerText="Estatus" sortBy="#{loan.loanStatus.value}" filterBy="#{loan.loanStatus.value}">
<h:outputText value="#{loan.loanStatus.value}" />
</p:column>
<p:column headerText="Fecha venta" sortBy="#{loan.createdOn}" filterBy="#{loan.createdOn}">
<h:outputText value="#{loan.createdOn}">
<f:convertDateTime type="date" locale="es" timeZone="GMT-6" pattern="dd - MMMM - yyyy"/>
</h:outputText>
</p:column>
<p:column headerText="Acción" style="text-align: center">
<p:column headerText="Ubicación" style="text-align: center">
<p:commandButton
value="Ver ubicación"
onclick="window.open('https://www.google.com/maps?q=' + #{loan.latitud} + ',' + #{loan.longitud}, '_blank'); return false;"
rendered="#{not empty loan.latitud and not empty loan.longitud}" />
</p:column>
</p:column>
</p:dataTable>
</div>
</div>
</h:form>
<h:form id="loanForm">