-CORRECCIÓN DE HORAS EN LOS NEW DATE() PARA LOS REGISTROS EN EL WS

This commit is contained in:
Brayan.Gonzalez 2025-03-04 09:31:47 -07:00
parent 78d9e09391
commit 25fde10e97
6 changed files with 1117 additions and 1043 deletions

View File

@ -113,7 +113,7 @@ public class ExchangeEnebledUsersController implements Serializable {
Date date = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.HOUR, -7);
calendar.add(Calendar.HOUR_OF_DAY, -7);
date = calendar.getTime();
parameters.add(new ModelParameter(TransferCfg.FIELD_LAST_UPDATED_ON, date));
parameters.add(new ModelParameter(TransferCfg.FIELD_ID, transerId));

View File

@ -284,6 +284,12 @@ public class LoanController implements Serializable {
String comments = "Se pago " + precio + texto;
Date date = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.HOUR_OF_DAY, -7);
date = calendar.getTime();
LoanDetails details = new LoanDetails(
UUID.randomUUID().toString(),
new Loan(feesToPayByLoanRequestJaxb.getIdLoan()),
@ -294,7 +300,7 @@ public class LoanController implements Serializable {
LoanDetailsType.PAYMENT,
comments,
feesToPayByLoanRequestJaxb.getIdUser(),
new Date());
date);
parameters.add(new ModelParameter(LoanDetailsCfg.FIELD_ID, ids));
@ -408,9 +414,6 @@ public class LoanController implements Serializable {
throw new Exception(user_unavailable);
}
//DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = new Date();//dateFormat.parse(jaxb.getStrDate());
LoanByUser loanByUser = new LoanByUser(
new LoanByUserId(null, jaxb.getUserId()),
LoanStatus.PENDING,
@ -420,6 +423,12 @@ public class LoanController implements Serializable {
LoanType loanType = loanTypeRepository.findLoanType(jaxb.getLoanTypeId());
RouteCtlg routeCtlg = new RouteCtlg(jaxb.getRouteId());
Date date = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.HOUR_OF_DAY, -7);
date = calendar.getTime();
Loan loan = new Loan(
new LoanType(loanType.getId()),
null,
@ -548,7 +557,13 @@ public class LoanController implements Serializable {
LoanFeeNotification notification = null;
try {
Date date = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.HOUR_OF_DAY, -7);
date = calendar.getTime();
List<ModelParameter> parameters = new ArrayList<>();
Loan loan = loanRepository.findLoanById(transfer.getLoanId());
@ -712,7 +727,12 @@ public class LoanController implements Serializable {
PersonJaxb endorsement) throws Exception {
logger.debug("renovation");
try {
Date date = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.HOUR_OF_DAY, -7);
date = calendar.getTime();
Loan currentLoan = loanRepository.findLoanById(loan);
LoanType newCredit = loanTypeRepository.findLoanType(credit);
@ -844,7 +864,12 @@ public class LoanController implements Serializable {
PersonJaxb endorsement) throws Exception {
logger.debug("renovationHasPaymentToday");
try {
Date date = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.HOUR_OF_DAY, -7);
date = calendar.getTime();
Loan currentLoan = loanRepository.findLoanById(loan);
LoanType newCredit = loanTypeRepository.findLoanType(credit);
@ -972,6 +997,12 @@ public class LoanController implements Serializable {
totalAmountPaid = loan.getAmountPaid().add(discount);
newLastReferenceNumber = loan.getLastReferenceNumber() + 1;
Date date = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.HOUR_OF_DAY, -7);
date = calendar.getTime();
loanDetails = new LoanDetails(
new Loan(loanByRenovation.getLoanOld().getId()),
new User(user),
@ -980,7 +1011,7 @@ public class LoanController implements Serializable {
newLastReferenceNumber,
LoanDetailsType.RENOVATION_PAYMENT,
user,
new Date(),
date,
"Retención de " + discount + " el la entrega del crédito renovado");
}
@ -1055,6 +1086,12 @@ public class LoanController implements Serializable {
totalAmountPaid = loan.getAmountPaid().add(discount);
newLastReferenceNumber = loan.getLastReferenceNumber() + 1;
Date date = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.HOUR_OF_DAY, -7);
date = calendar.getTime();
loanDetails = new LoanDetails(
new Loan(loanByRenovation.getLoanOld().getId()),
new User(user),
@ -1063,7 +1100,7 @@ public class LoanController implements Serializable {
newLastReferenceNumber,
LoanDetailsType.RENOVATION_PAYMENT,
user,
new Date(),
date,
"Retención de " + discount + " el la entrega del crédito renovado");
}
@ -1269,11 +1306,17 @@ public class LoanController implements Serializable {
loans.add(new Loan(row.getIdLoan()));
});
Date date = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.HOUR_OF_DAY, -7);
date = calendar.getTime();
loanParams.add(new ModelParameter(LoanCfg.FIELD_LOAN_STATUS, loanStatus));
loanParams.add(new ModelParameter(LoanCfg.FIELD_AMOUNT_PAID, new BigDecimal(0)));
loanParams.add(new ModelParameter(LoanCfg.FIELD_LAST_REFERENCE_NUMBER, 0));
loanParams.add(new ModelParameter(LoanCfg.FIELD_LAST_UPDATED_BY, updateLoanToDeliveryStatusList.getIdUpdateUser()));
loanParams.add(new ModelParameter(LoanCfg.FIELD_LAST_UPDATED_ON, new Date()));
loanParams.add(new ModelParameter(LoanCfg.FIELD_LAST_UPDATED_ON, date));
loanParams.add(new ModelParameter(LoanCfg.FIELD_ID, ids));
loanByUserParams.add(new ModelParameter(LoanByUserCfg.FIELD_LOAN_BY_USER_STATUS, loanStatus));
@ -1300,7 +1343,12 @@ public class LoanController implements Serializable {
logger.debug("updateLoanByIdFromCertifiedView");
try {
List<ModelParameter> parameters = new ArrayList<>();
Date date = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.HOUR_OF_DAY, -7);
date = calendar.getTime();
parameters.add(
new ModelParameter(LoanCfg.FIELD_LOAN_STATUS, action ? LoanStatus.APPROVED : LoanStatus.REJECTED)

View File

@ -23,6 +23,7 @@ import com.arrebol.apc.model.loan.LoanDetails;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import org.apache.logging.log4j.LogManager;
@ -94,7 +95,13 @@ public class LoanByRenovationRepository extends GenericRepository implements Ser
try {
openConnection();
Date lastUpdatedOn = new Date();
Date date2 = new Date();
Calendar calendar2 = Calendar.getInstance();
calendar2.setTime(date2);
calendar2.add(Calendar.HOUR_OF_DAY, -7);
date2 = calendar2.getTime();
Date lastUpdatedOn = date2;
List<ModelParameter> parameters = new ArrayList<>();
// Update loanByRenovation details in Renovation table
@ -172,13 +179,19 @@ public class LoanByRenovationRepository extends GenericRepository implements Ser
getSession().save(loanDetails);
}
Date date = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.HOUR_OF_DAY, -7);
date = calendar.getTime();
// Insert delivery details (To know cash that certifier deliveried) in Delivery Table
Delivery delivery = new Delivery(
new User(userId),
new Loan(loanByRenovation.getLoanNew().getId()),
amount,
userId,
new Date(),
date,
comission
);

View File

@ -16,6 +16,7 @@ import com.arrebol.apc.model.loan.LoanDetails;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import javax.persistence.Tuple;
@ -122,7 +123,13 @@ public class LoanDetailsRepository extends GenericRepository implements Serializ
loan.setAmountPaid(totalFees);
loan.setLastReferenceNumber(loan.getLastReferenceNumber() + 1);
loan.setLastUpdatedBy(loanDetails.getCreatedBy());
loan.setLastUpdatedOn(new Date());
Date date = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.HOUR_OF_DAY, -7);
date = calendar.getTime();
loan.setLastUpdatedOn(date);
sssn.update(loan);

View File

@ -14,6 +14,7 @@ import com.arrebol.apc.model.core.User;
import com.arrebol.apc.model.enums.GenericStatus;
import com.arrebol.apc.model.gasoline.Gasoline;
import java.io.Serializable;
import java.util.Calendar;
import java.util.Date;
import java.util.UUID;
import javax.ws.rs.FormParam;
@ -46,6 +47,12 @@ public class GasolineWS implements Serializable {
try {
GasolineController controller = new GasolineController();
Date date = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.HOUR_OF_DAY, -7);
date = calendar.getTime();
Gasoline gasoline = new Gasoline(
UUID.randomUUID().toString(),
new User(idUser),
@ -57,7 +64,7 @@ public class GasolineWS implements Serializable {
GenericStatus.ENABLED,
description,
idUser,
new Date());
date);
if (controller.saveNewGasolinePayment(gasoline)) {
response = Response.ok().build();

View File

@ -22,12 +22,12 @@ import com.arrebol.apc.model.enums.TransferStatus;
import com.arrebol.apc.model.loan.Loan;
import com.arrebol.apc.model.loan.LoanDetails;
import com.arrebol.apc.model.system.logs.Bitacora;
import com.arrebol.apc.model.ws.parsed.LoanRequestedJaxb;
import com.arrebol.apc.model.views.AvailableCustomersView;
import com.arrebol.apc.model.views.AvailableEndorsementsView;
import com.arrebol.apc.model.views.LoanToDeliveryByCertifierView;
import com.arrebol.apc.model.ws.parsed.FeesToPayByLoanRequestJaxb;
import com.arrebol.apc.model.ws.parsed.LoanDetailJaxb;
import com.arrebol.apc.model.ws.parsed.LoanRequestedJaxb;
import com.arrebol.apc.model.ws.parsed.NewAmountJaxb;
import com.arrebol.apc.model.ws.parsed.NewTransferAccountJaxb;
import com.arrebol.apc.model.ws.parsed.RenovationWithEndorsementJaxb;
@ -314,9 +314,8 @@ public class LoanWS implements Serializable {
Response response;
try {
/**
* This method is for get all loan types applying some business
* rules, like number of Fees and if you are ok in 100% you can get
* next loan.
* This method is for get all loan types applying some business rules,
* like number of Fees and if you are ok in 100% you can get next loan.
*/
//response = Response.ok(loanController.findNewCreditLimit(office, loan)).build();
response = Response.ok(loanController.findAllLoansTypeByOffice(office)).build();