-MODIFICACIONES EN EL WS PARA LA IMPRESIÓN DEL TICKET DE PAGO

This commit is contained in:
Brayan.Gonzalez 2025-06-11 19:11:13 -06:00
parent ddbeffb215
commit 624d45589e
8 changed files with 384 additions and 156 deletions

View File

@ -1105,6 +1105,29 @@ public class LoanController implements Serializable {
}
}
/**
*
* @param idLoan
* @return
* @throws Exception
*/
public List<LoanDetailJaxb> approvedDetailsFromTiketByIdLoan(String idLoan) throws Exception {
logger.debug("approvedDetailsFromTiketByIdLoan");
try {
List<ModelParameter> parameters = new ArrayList<>();
parameters.add(new ModelParameter(LoanDetailsCfg.FIELD_ID_LOAN, new Loan(idLoan)));
return loanApprovedDetailViewRepository.findLoanDetailsFromTikedByLoan(
LoanDetailsCfg.QUERY_FIND_LOAN_DETAILS_FROM_TIKET_BY_LOAN,
parameters
);
} catch (Exception e) {
logger.error("approvedDetailsFromTiketByIdLoan", e);
throw e;
}
}
/**
* Searching all loan details by id.
*

View File

@ -102,6 +102,62 @@ public class LoanApprovedDetailViewRepository extends GenericRepository implemen
}
}
/**
*
* @param xmlQuery
* @param parameters
* @return
* @throws Exception
*/
public List<LoanDetailJaxb> findLoanDetailsFromTikedByLoan(String xmlQuery, List<ModelParameter> parameters) throws Exception {
logger.debug("Consulta actual recibida: {}", xmlQuery);
logger.debug("findLoanDetailsFromTikedByLoan");
List<LoanDetailJaxb> results = new ArrayList<>();
try {
List<Tuple> tuples = xmlQueryTuple(xmlQuery, parameters);
double total = 0d;
for (Tuple tuple : tuples) {
if (results.isEmpty()) {
total = ((BigDecimal) tuple.get("amountToPay")).doubleValue();
}
LoanDetailsType type = tuple.get("loanDetailsType", LoanDetailsType.class);
switch (type) {
case PAYMENT:
total = total - ((BigDecimal) tuple.get("paymentAmount")).doubleValue();
break;
case FEE:
total = total + ((BigDecimal) tuple.get("paymentAmount")).doubleValue();
break;
case TRANSFER:
total = total - (tuple.get("paymentAmount", BigDecimal.class)).doubleValue();
break;
}
LoanDetailJaxb detail = new LoanDetailJaxb(
tuple.get("createdOn", String.class),
((BigDecimal) tuple.get("paymentAmount")).doubleValue(),
total,
tuple.get("comments", String.class),
type.toString(),
tuple.get("fullNameVendedor", String.class),
tuple.get("fullNameCliente", String.class),
tuple.get("numeroCuenta", String.class),
tuple.get("fullNameCrobrador", String.class)
);
results.add(detail);
}
return results;
} catch (Exception e) {
logger.error("findLoanDetailsFromTikedByLoan", e);
throw e;
}
}
/**
*
* @param idLoan

View File

@ -14,6 +14,7 @@ package com.arrebol.apc.model.core.constance;
public interface LoanDetailsCfg extends GenericCfg {
String QUERY_FIND_LOAN_DETAILS_BY_LOAN = "findLoanDetailsByLoan";
String QUERY_FIND_LOAN_DETAILS_FROM_TIKET_BY_LOAN = "findLoanDetailsFromTikedByLoan";
String QUERY_FIND_FEES_TO_PAY_BY_LOAN_ID = "findFeesToPayByLoanId";
String QUERY_FIND_ALL_FEES_BY_LOAN_ID = "findAllFeesByLoanId";
String QUERY_UPDATE_PAID_FEES_STATUS_IN_LOAN_DETAILS_IDS = "updatePaidFeesStatusInLoanDetailIds";

View File

@ -24,9 +24,39 @@ public class LoanDetailJaxb {
private String comment;
private String paymentType;
private String fullNameVendedor;
private String fullNameCliente;
private String numeroCuenta;
private String fullNameCrobrador;
public LoanDetailJaxb() {
}
/**
* Created for add transfer accoutn payments.
*
* @param paymentDate
* @param paymentOfDay
* @param toPay
* @param comment
* @param paymentType
* @param fullNameVendedor
* @param fullNameCliente
* @param numeroCuenta
* @param fullNameCrobrador
*/
public LoanDetailJaxb(String paymentDate, double paymentOfDay, double toPay, String comment, String paymentType, String fullNameVendedor, String fullNameCliente, String numeroCuenta, String fullNameCrobrador) {
this.paymentDate = paymentDate;
this.paymentOfDay = paymentOfDay;
this.toPay = toPay;
this.comment = comment;
this.paymentType = paymentType;
this.fullNameVendedor = fullNameVendedor;
this.fullNameCliente = fullNameCliente;
this.numeroCuenta = numeroCuenta;
this.fullNameCrobrador = fullNameCrobrador;
}
/**
* Created for add transfer accoutn payments.
*
@ -114,6 +144,42 @@ public class LoanDetailJaxb {
this.paymentType = paymentType;
}
@XmlElement(name = "fullNameCliente")
public String getFullNameCliente() {
return fullNameCliente;
}
public void setFullNameCliente(String fullNameCliente) {
this.fullNameCliente = fullNameCliente;
}
@XmlElement(name = "numeroCuenta")
public String getNumeroCuenta() {
return numeroCuenta;
}
public void setNumeroCuenta(String numeroCuenta) {
this.numeroCuenta = numeroCuenta;
}
@XmlElement(name = "fullNameVendedor")
public String getFullNameVendedor() {
return fullNameVendedor;
}
public void setFullNameVendedor(String fullNameVendedor) {
this.fullNameVendedor = fullNameVendedor;
}
@XmlElement(name = "fullNameCrobrador")
public String getFullNameCrobrador() {
return fullNameCrobrador;
}
public void setFullNameCrobrador(String fullNameCrobrador) {
this.fullNameCrobrador = fullNameCrobrador;
}
@Override
public String toString() {
return "LoanDetailJaxb{" + "paymentDate=" + paymentDate + ", paymentOfDay=" + paymentOfDay + ", toPay=" + toPay + ", payment=" + payment + '}';

View File

@ -23,6 +23,45 @@
]]>
</query>
<query name="findLoanDetailsFromTikedByLoan">
<![CDATA[
SELECT
DATE_FORMAT(ld.createdOn, '%d-%m-%Y') AS createdOn,
ld.paymentAmount AS paymentAmount,
ld.loanDetailsType AS loanDetailsType,
lt.paymentTotal AS amountToPay,
ld.comments AS comments,
CONCAT(per.firstName, ' ',
IFNULL(CONCAT(per.secondName, ' '), ''),
per.lastName, ' ',
per.middleName) AS fullNameVendedor,
CONCAT(peo.firstName, ' ',
IFNULL(CONCAT(peo.secondName, ' '), ''),
peo.lastName, ' ',
IFNULL(peo.middleName, '')) AS fullNameCliente,
CONCAT(IFNULL(peo.contrato, ''), ' - ', IFNULL(rut.route, '')) AS numeroCuenta,
CONCAT(perv.firstName, ' ',
IFNULL(CONCAT(perv.secondName, ' '), ''),
perv.lastName, ' ',
perv.middleName) AS fullNameCrobrador
FROM
LoanDetails ld
INNER JOIN Loan l ON ld.loan = l.id
INNER JOIN LoanType lt ON l.loanType = lt.id
INNER JOIN People peo ON l.customer.id = peo.id
INNER JOIN RouteCtlg rut ON peo.routeCtlg.id = rut.id
INNER JOIN User us ON ld.user.id = us.id
LEFT JOIN HumanResource per ON us.humanResource.id = per.id
INNER JOIN User ven ON ld.createdBy = ven.id
LEFT JOIN HumanResource perv ON ven.humanResource.id = perv.id
WHERE
ld.loan = :loan
ORDER BY
ld.createdOn,
ld.referenceNumber
]]>
</query>
<query name="findLoanDetailsPaymentCurdateByLoan">
<![CDATA[
SELECT

View File

@ -15,7 +15,7 @@ Any value defined here will override the pom.xml file value but is only applicab
-->
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>1.8-web</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>
<org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>ide</org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>
<netbeans.hint.jdkPlatform>AWS_corretto_JDK_8</netbeans.hint.jdkPlatform>
<netbeans.hint.jdkPlatform>JDK_1.8</netbeans.hint.jdkPlatform>
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>Tomcat</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
</properties>
</project-shared-configuration>

View File

@ -117,6 +117,12 @@
<artifactId>jersey-media-multipart</artifactId>
<version>2.27</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.moxy</artifactId>
<version>2.7.4</version>
</dependency>
<!--
Java Servlet is the foundation web specification
in the Java Enterprise Platform.
@ -153,6 +159,13 @@
<artifactId>jersey-hk2</artifactId>
<version>2.27</version>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.json</artifactId>
<version>1.1.4</version>
</dependency>
<!--
Testing
-->
@ -178,6 +191,14 @@
</dependencies>
<profiles>
<profile>
<id>Localhost</id>
<properties>
<hibernate.connection.url>jdbc:mysql://localhost:3306/apo_pro_com_april_ten?serverTimezone=UTC</hibernate.connection.url>
<hibernate.connection.username>root</hibernate.connection.username>
<hibernate.connection.password>Saladeespera2_</hibernate.connection.password>
</properties>
</profile>
<profile>
<id>Localhost-Mobile-APP</id>
<properties>

View File

@ -499,6 +499,28 @@ public class LoanWS implements Serializable {
return response;
}
@GET
@Path("approved-details-print")
@Produces(MediaType.APPLICATION_JSON)
public Response approvedDetailsFromTiketByIdLoan(@QueryParam("id") String loan) {
logger.debug("approvedDetailsFromTiketByIdLoan");
Response response;
try {
GenericEntity<List<LoanDetailJaxb>> results
= new GenericEntity< List< LoanDetailJaxb>>(
loanController.approvedDetailsFromTiketByIdLoan(loan)
) {
};
response = Response.ok(results).build();
} catch (Exception e) {
logger.error("approvedDetailsFromTiketByIdLoan", e);
response = Response.status(Response.Status.NOT_ACCEPTABLE).build();
}
return response;
}
@PUT
@Path("renovation-with-endorsement")
@Consumes(MediaType.APPLICATION_JSON)