Compare commits
3 Commits
d44659160b
...
6ec0f569e1
Author | SHA1 | Date | |
---|---|---|---|
6ec0f569e1 | |||
25fde10e97 | |||
78d9e09391 |
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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.controller.mobile.controller.exchange;
|
||||
@ -22,6 +22,7 @@ import com.arrebol.apc.model.ws.parsed.Exchange;
|
||||
import com.arrebol.apc.model.ws.parsed.ExchangeJaxb;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@ -33,133 +34,138 @@ import org.apache.logging.log4j.Logger;
|
||||
*/
|
||||
public class ExchangeEnebledUsersController implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param userId
|
||||
* @param officeId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<ExchangeEnebledUsersView> findEnebledUsersToUserId(String userId, String officeId) throws Exception {
|
||||
logger.debug("exchangeEnebledUsersViewRepository");
|
||||
try {
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
/**
|
||||
*
|
||||
* @param userId
|
||||
* @param officeId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<ExchangeEnebledUsersView> findEnebledUsersToUserId(String userId, String officeId) throws Exception {
|
||||
logger.debug("exchangeEnebledUsersViewRepository");
|
||||
try {
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(
|
||||
new ModelParameter(
|
||||
ExchangeEnebledUsersViewCfg.PARAM_OFFICE_ID,
|
||||
officeId
|
||||
)
|
||||
);
|
||||
parameters.add(
|
||||
new ModelParameter(
|
||||
ExchangeEnebledUsersViewCfg.PARAM_OFFICE_ID,
|
||||
officeId
|
||||
)
|
||||
);
|
||||
|
||||
parameters.add(
|
||||
new ModelParameter(
|
||||
ExchangeEnebledUsersViewCfg.FIELD_VIEW_ID,
|
||||
userId
|
||||
)
|
||||
);
|
||||
parameters.add(
|
||||
new ModelParameter(
|
||||
ExchangeEnebledUsersViewCfg.FIELD_VIEW_ID,
|
||||
userId
|
||||
)
|
||||
);
|
||||
|
||||
return exchangeEnebledUsersViewRepository.findEnebledUsersToUserId(
|
||||
ExchangeEnebledUsersViewCfg.QUERY_FIND_ENEBLED_USERS_TO_USER_ID,
|
||||
parameters
|
||||
);
|
||||
} catch (Exception e) {
|
||||
logger.error("findEnebledUsersToUserId", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
return exchangeEnebledUsersViewRepository.findEnebledUsersToUserId(
|
||||
ExchangeEnebledUsersViewCfg.QUERY_FIND_ENEBLED_USERS_TO_USER_ID,
|
||||
parameters
|
||||
);
|
||||
} catch (Exception e) {
|
||||
logger.error("findEnebledUsersToUserId", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param jaxb
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean newExchange(ExchangeJaxb jaxb) throws Exception {
|
||||
logger.debug("newExchange");
|
||||
try {
|
||||
Transfer transfer = new Transfer(
|
||||
new User(jaxb.getSenderId()),
|
||||
new User(jaxb.getReceiverId()),
|
||||
ActiveStatus.ENEBLED,
|
||||
ActionStatus.PENDING,
|
||||
jaxb.getAmount(),
|
||||
new Office(jaxb.getOfficeId()),
|
||||
jaxb.getSenderId());
|
||||
/**
|
||||
*
|
||||
* @param jaxb
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean newExchange(ExchangeJaxb jaxb) throws Exception {
|
||||
logger.debug("newExchange");
|
||||
try {
|
||||
Transfer transfer = new Transfer(
|
||||
new User(jaxb.getSenderId()),
|
||||
new User(jaxb.getReceiverId()),
|
||||
ActiveStatus.ENEBLED,
|
||||
ActionStatus.PENDING,
|
||||
jaxb.getAmount(),
|
||||
new Office(jaxb.getOfficeId()),
|
||||
jaxb.getSenderId());
|
||||
|
||||
return transferRepository.addTransfer(transfer);
|
||||
} catch (Exception e) {
|
||||
logger.error("newExchange", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
return transferRepository.addTransfer(transfer);
|
||||
} catch (Exception e) {
|
||||
logger.error("newExchange", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param transerId
|
||||
* @param userId
|
||||
* @param isApproved
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean updateExchange(String transerId, String userId, boolean isApproved) throws Exception {
|
||||
logger.debug("updateExchange");
|
||||
try {
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
/**
|
||||
*
|
||||
* @param transerId
|
||||
* @param userId
|
||||
* @param isApproved
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean updateExchange(String transerId, String userId, boolean isApproved) throws Exception {
|
||||
logger.debug("updateExchange");
|
||||
try {
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(TransferCfg.FIELD_ACTION_STATUS, isApproved ? ActionStatus.APPROVED : ActionStatus.REJECTED));
|
||||
parameters.add(new ModelParameter(TransferCfg.FIELD_LAST_UPDATED_BY, userId));
|
||||
parameters.add(new ModelParameter(TransferCfg.FIELD_LAST_UPDATED_ON, new Date()));
|
||||
parameters.add(new ModelParameter(TransferCfg.FIELD_ID, transerId));
|
||||
parameters.add(new ModelParameter(TransferCfg.FIELD_ACTION_STATUS, isApproved ? ActionStatus.APPROVED : ActionStatus.REJECTED));
|
||||
parameters.add(new ModelParameter(TransferCfg.FIELD_LAST_UPDATED_BY, userId));
|
||||
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(TransferCfg.FIELD_LAST_UPDATED_ON, date));
|
||||
parameters.add(new ModelParameter(TransferCfg.FIELD_ID, transerId));
|
||||
|
||||
return transferRepository.updateTransfer(TransferCfg.QUERY_UPDATE_TRANSFER_BY_ACTION, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("updateExchange", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
return transferRepository.updateTransfer(TransferCfg.QUERY_UPDATE_TRANSFER_BY_ACTION, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("updateExchange", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<Exchange> exchangesByUsers(String userId) throws Exception {
|
||||
logger.debug("exchangesByUsers");
|
||||
try {
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
/**
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<Exchange> exchangesByUsers(String userId) throws Exception {
|
||||
logger.debug("exchangesByUsers");
|
||||
try {
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(
|
||||
new ModelParameter(
|
||||
TransferCfg.FIELD_USER_TRANSMITTER,
|
||||
new User(userId)
|
||||
)
|
||||
);
|
||||
|
||||
parameters.add(
|
||||
new ModelParameter(
|
||||
TransferCfg.FIELD_USER_RECEIVER,
|
||||
new User(userId)
|
||||
)
|
||||
);
|
||||
parameters.add(
|
||||
new ModelParameter(
|
||||
TransferCfg.FIELD_USER_TRANSMITTER,
|
||||
new User(userId)
|
||||
)
|
||||
);
|
||||
|
||||
return transferRepository.findAllTransferByUserIdAndCurdate(TransferCfg.QUERY_FIND_ALL_TRANSFER_BY_USER_ID_AND_CURDATE, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("exchangesByUsers", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
parameters.add(
|
||||
new ModelParameter(
|
||||
TransferCfg.FIELD_USER_RECEIVER,
|
||||
new User(userId)
|
||||
)
|
||||
);
|
||||
|
||||
private static final long serialVersionUID = 2625775904919860613L;
|
||||
final Logger logger = LogManager.getLogger(ExchangeEnebledUsersController.class);
|
||||
return transferRepository.findAllTransferByUserIdAndCurdate(TransferCfg.QUERY_FIND_ALL_TRANSFER_BY_USER_ID_AND_CURDATE, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("exchangesByUsers", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private final ExchangeEnebledUsersViewRepository exchangeEnebledUsersViewRepository;
|
||||
private final TransferRepository transferRepository;
|
||||
private static final long serialVersionUID = 2625775904919860613L;
|
||||
final Logger logger = LogManager.getLogger(ExchangeEnebledUsersController.class);
|
||||
|
||||
public ExchangeEnebledUsersController() {
|
||||
this.exchangeEnebledUsersViewRepository = new ExchangeEnebledUsersViewRepository();
|
||||
this.transferRepository = new TransferRepository();
|
||||
}
|
||||
private final ExchangeEnebledUsersViewRepository exchangeEnebledUsersViewRepository;
|
||||
private final TransferRepository transferRepository;
|
||||
|
||||
public ExchangeEnebledUsersController() {
|
||||
this.exchangeEnebledUsersViewRepository = new ExchangeEnebledUsersViewRepository();
|
||||
this.transferRepository = new TransferRepository();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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.controller.mobile.repository.loan;
|
||||
@ -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;
|
||||
@ -35,185 +36,197 @@ import org.hibernate.query.Query;
|
||||
*/
|
||||
public class LoanByRenovationRepository extends GenericRepository implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1357519239619447184L;
|
||||
final Logger logger = LogManager.getLogger(LoanByRenovationRepository.class);
|
||||
private static final long serialVersionUID = 1357519239619447184L;
|
||||
final Logger logger = LogManager.getLogger(LoanByRenovationRepository.class);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param newLoanId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public LoanByRenovation findLoanRenovationByNewLoanId(String newLoanId) throws Exception {
|
||||
logger.debug("findLoanRenovationByNewLoanId");
|
||||
try {
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
/**
|
||||
*
|
||||
* @param newLoanId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public LoanByRenovation findLoanRenovationByNewLoanId(String newLoanId) throws Exception {
|
||||
logger.debug("findLoanRenovationByNewLoanId");
|
||||
try {
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(
|
||||
new ModelParameter(LoanByRenovationCfg.FIELD_LOAN_NEW, new Loan(newLoanId))
|
||||
);
|
||||
parameters.add(
|
||||
new ModelParameter(LoanByRenovationCfg.FIELD_LOAN_NEW, new Loan(newLoanId))
|
||||
);
|
||||
|
||||
return (LoanByRenovation) createNamedQueryUniqueResult(
|
||||
LoanByRenovation.class,
|
||||
LoanByRenovationCfg.QUERY_FIND_LOAN_RENOVATION_BY_NEW_LOAN_ID,
|
||||
parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("findLoanRenovationByNewLoanId", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
return (LoanByRenovation) createNamedQueryUniqueResult(
|
||||
LoanByRenovation.class,
|
||||
LoanByRenovationCfg.QUERY_FIND_LOAN_RENOVATION_BY_NEW_LOAN_ID,
|
||||
parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("findLoanRenovationByNewLoanId", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param loanByRenovation
|
||||
* @param userId
|
||||
* @param comments
|
||||
* @param action
|
||||
* @param amount
|
||||
* @param discount
|
||||
* @param loanDetails
|
||||
* @param totalAmountPaid
|
||||
* @param newLastReferenceNumber
|
||||
* @param comission
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean updateLoanRenovationFromCerfierView(
|
||||
LoanByRenovation loanByRenovation,
|
||||
String userId,
|
||||
String comments,
|
||||
boolean action,
|
||||
BigDecimal amount,
|
||||
BigDecimal discount,
|
||||
LoanDetails loanDetails,
|
||||
BigDecimal totalAmountPaid,
|
||||
Integer newLastReferenceNumber,
|
||||
ComissionType comission) throws Exception {
|
||||
logger.debug("updateLoanRenovationFromCerfierView");
|
||||
boolean success = false;
|
||||
try {
|
||||
openConnection();
|
||||
/**
|
||||
*
|
||||
* @param loanByRenovation
|
||||
* @param userId
|
||||
* @param comments
|
||||
* @param action
|
||||
* @param amount
|
||||
* @param discount
|
||||
* @param loanDetails
|
||||
* @param totalAmountPaid
|
||||
* @param newLastReferenceNumber
|
||||
* @param comission
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean updateLoanRenovationFromCerfierView(
|
||||
LoanByRenovation loanByRenovation,
|
||||
String userId,
|
||||
String comments,
|
||||
boolean action,
|
||||
BigDecimal amount,
|
||||
BigDecimal discount,
|
||||
LoanDetails loanDetails,
|
||||
BigDecimal totalAmountPaid,
|
||||
Integer newLastReferenceNumber,
|
||||
ComissionType comission) throws Exception {
|
||||
logger.debug("updateLoanRenovationFromCerfierView");
|
||||
boolean success = false;
|
||||
try {
|
||||
openConnection();
|
||||
|
||||
Date lastUpdatedOn = new Date();
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
Date date2 = new Date();
|
||||
Calendar calendar2 = Calendar.getInstance();
|
||||
calendar2.setTime(date2);
|
||||
calendar2.add(Calendar.HOUR_OF_DAY, -7);
|
||||
date2 = calendar2.getTime();
|
||||
|
||||
// Update loanByRenovation details in Renovation table
|
||||
parameters.add(new ModelParameter(LoanByRenovationCfg.FIELD_LOAN_RENOVATION_STATUS, action ? LoanRenovationStatus.APPROVED : LoanRenovationStatus.REJECTED));
|
||||
parameters.add(new ModelParameter(LoanByRenovationCfg.FIELD_COMMENTS, comments));
|
||||
parameters.add(new ModelParameter(LoanByRenovationCfg.FIELD_LAST_UPDATED_BY, userId));
|
||||
parameters.add(new ModelParameter(LoanByRenovationCfg.FIELD_LAST_UPDATED_ON, lastUpdatedOn));
|
||||
parameters.add(new ModelParameter(LoanByRenovationCfg.FIELD_ID, loanByRenovation.getId()));
|
||||
Date lastUpdatedOn = date2;
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
if (0 < executeQuery(LoanByRenovationCfg.QUERY_UPDATE_LOAN_RENOVATION, parameters)) {
|
||||
// Update loanByRenovation details in Renovation table
|
||||
parameters.add(new ModelParameter(LoanByRenovationCfg.FIELD_LOAN_RENOVATION_STATUS, action ? LoanRenovationStatus.APPROVED : LoanRenovationStatus.REJECTED));
|
||||
parameters.add(new ModelParameter(LoanByRenovationCfg.FIELD_COMMENTS, comments));
|
||||
parameters.add(new ModelParameter(LoanByRenovationCfg.FIELD_LAST_UPDATED_BY, userId));
|
||||
parameters.add(new ModelParameter(LoanByRenovationCfg.FIELD_LAST_UPDATED_ON, lastUpdatedOn));
|
||||
parameters.add(new ModelParameter(LoanByRenovationCfg.FIELD_ID, loanByRenovation.getId()));
|
||||
|
||||
parameters.clear();
|
||||
if (0 < executeQuery(LoanByRenovationCfg.QUERY_UPDATE_LOAN_RENOVATION, parameters)) {
|
||||
|
||||
// Update NEW loan details in Loan table
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_LOAN_STATUS, action ? LoanStatus.APPROVED : LoanStatus.REJECTED));
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_COMMENTS, comments));
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_CREATED_ON, lastUpdatedOn));
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_LAST_UPDATED_BY, userId));
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_LAST_UPDATED_ON, lastUpdatedOn));
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_ID, loanByRenovation.getLoanNew().getId()));
|
||||
parameters.clear();
|
||||
|
||||
if (0 < executeQuery(LoanCfg.QUERY_UPDATE_LOAN_WITH_CREATED_ON_BY_ID_FROM_CERTIFIER_VIEW, parameters)) {
|
||||
parameters.clear();
|
||||
// Update NEW loan details in Loan table
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_LOAN_STATUS, action ? LoanStatus.APPROVED : LoanStatus.REJECTED));
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_COMMENTS, comments));
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_CREATED_ON, lastUpdatedOn));
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_LAST_UPDATED_BY, userId));
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_LAST_UPDATED_ON, lastUpdatedOn));
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_ID, loanByRenovation.getLoanNew().getId()));
|
||||
|
||||
// Update OLD loan details in Loan table
|
||||
String commentsOldLoan = action ? "Crédito renovado" : "El certificador rechazo la renovación de este crédito";
|
||||
String strQuery = LoanCfg.QUERY_UPDATE_LOAN_BY_ID_FROM_CERTIFIER_VIEW;
|
||||
if (0 < executeQuery(LoanCfg.QUERY_UPDATE_LOAN_WITH_CREATED_ON_BY_ID_FROM_CERTIFIER_VIEW, parameters)) {
|
||||
parameters.clear();
|
||||
|
||||
if (action && null != loanDetails && null != totalAmountPaid && null != newLastReferenceNumber) {
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_AMOUNT_PAID, totalAmountPaid));
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_LAST_REFERENCE_NUMBER, newLastReferenceNumber));
|
||||
// Update OLD loan details in Loan table
|
||||
String commentsOldLoan = action ? "Crédito renovado" : "El certificador rechazo la renovación de este crédito";
|
||||
String strQuery = LoanCfg.QUERY_UPDATE_LOAN_BY_ID_FROM_CERTIFIER_VIEW;
|
||||
|
||||
strQuery = LoanCfg.QUERY_UPDATE_DISCOUNT_AND_LOAN_BY_ID_FROM_CERTIFIER_VIEW;
|
||||
}
|
||||
if (action && null != loanDetails && null != totalAmountPaid && null != newLastReferenceNumber) {
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_AMOUNT_PAID, totalAmountPaid));
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_LAST_REFERENCE_NUMBER, newLastReferenceNumber));
|
||||
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_LOAN_STATUS, action ? LoanStatus.FINISH : LoanStatus.APPROVED));
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_COMMENTS, commentsOldLoan));
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_LAST_UPDATED_BY, userId));
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_LAST_UPDATED_ON, lastUpdatedOn));
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_ID, loanByRenovation.getLoanOld().getId()));
|
||||
strQuery = LoanCfg.QUERY_UPDATE_DISCOUNT_AND_LOAN_BY_ID_FROM_CERTIFIER_VIEW;
|
||||
}
|
||||
|
||||
if (0 < executeQuery(strQuery, parameters)) {
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_LOAN_STATUS, action ? LoanStatus.FINISH : LoanStatus.APPROVED));
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_COMMENTS, commentsOldLoan));
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_LAST_UPDATED_BY, userId));
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_LAST_UPDATED_ON, lastUpdatedOn));
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_ID, loanByRenovation.getLoanOld().getId()));
|
||||
|
||||
// Update OLD loanByUser details in Loan By User Table
|
||||
List<ModelParameter> params = new ArrayList<>();
|
||||
if (0 < executeQuery(strQuery, parameters)) {
|
||||
|
||||
params.add(new ModelParameter(LoanByUserCfg.FIELD_LOAN, new Loan(loanByRenovation.getLoanOld().getId())));
|
||||
params.add(new ModelParameter(LoanByUserCfg.FIELD_LOAN_BY_USER_STATUS, action ? LoanStatus.FINISH : LoanStatus.APPROVED));
|
||||
// Update OLD loanByUser details in Loan By User Table
|
||||
List<ModelParameter> params = new ArrayList<>();
|
||||
|
||||
Query query1 = getSession().createNamedQuery(LoanByUserCfg.QUERY_UPDATE_LOAN_BY_USER_BY_LOAND_ID);
|
||||
params.add(new ModelParameter(LoanByUserCfg.FIELD_LOAN, new Loan(loanByRenovation.getLoanOld().getId())));
|
||||
params.add(new ModelParameter(LoanByUserCfg.FIELD_LOAN_BY_USER_STATUS, action ? LoanStatus.FINISH : LoanStatus.APPROVED));
|
||||
|
||||
params.forEach((param) -> {
|
||||
query1.setParameter(param.getParameter(), param.getValue());
|
||||
});
|
||||
Query query1 = getSession().createNamedQuery(LoanByUserCfg.QUERY_UPDATE_LOAN_BY_USER_BY_LOAND_ID);
|
||||
|
||||
query1.executeUpdate();
|
||||
params.forEach((param) -> {
|
||||
query1.setParameter(param.getParameter(), param.getValue());
|
||||
});
|
||||
|
||||
// Update NEW loanByUser details in Loan By User Table
|
||||
params.clear();
|
||||
query1.executeUpdate();
|
||||
|
||||
params.add(new ModelParameter(LoanByUserCfg.FIELD_LOAN, new Loan(loanByRenovation.getLoanNew().getId())));
|
||||
params.add(new ModelParameter(LoanByUserCfg.FIELD_LOAN_BY_USER_STATUS, action ? LoanStatus.APPROVED : LoanStatus.REJECTED));
|
||||
// Update NEW loanByUser details in Loan By User Table
|
||||
params.clear();
|
||||
|
||||
Query query2 = getSession().createNamedQuery(LoanByUserCfg.QUERY_UPDATE_LOAN_BY_USER_BY_LOAND_ID);
|
||||
params.add(new ModelParameter(LoanByUserCfg.FIELD_LOAN, new Loan(loanByRenovation.getLoanNew().getId())));
|
||||
params.add(new ModelParameter(LoanByUserCfg.FIELD_LOAN_BY_USER_STATUS, action ? LoanStatus.APPROVED : LoanStatus.REJECTED));
|
||||
|
||||
params.forEach((param) -> {
|
||||
query2.setParameter(param.getParameter(), param.getValue());
|
||||
});
|
||||
Query query2 = getSession().createNamedQuery(LoanByUserCfg.QUERY_UPDATE_LOAN_BY_USER_BY_LOAND_ID);
|
||||
|
||||
query2.executeUpdate();
|
||||
params.forEach((param) -> {
|
||||
query2.setParameter(param.getParameter(), param.getValue());
|
||||
});
|
||||
|
||||
if (action) {
|
||||
// Insert new loanDetails (discount) in Loan Details table
|
||||
if (null != loanDetails) {
|
||||
getSession().save(loanDetails);
|
||||
}
|
||||
query2.executeUpdate();
|
||||
|
||||
// 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(),
|
||||
comission
|
||||
);
|
||||
if (action) {
|
||||
// Insert new loanDetails (discount) in Loan Details table
|
||||
if (null != loanDetails) {
|
||||
getSession().save(loanDetails);
|
||||
}
|
||||
|
||||
getSession().save(delivery);
|
||||
}
|
||||
Date date = new Date();
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
calendar.add(Calendar.HOUR_OF_DAY, -7);
|
||||
date = calendar.getTime();
|
||||
|
||||
flushAndClear();
|
||||
closeConnection();
|
||||
// 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,
|
||||
date,
|
||||
comission
|
||||
);
|
||||
|
||||
logger.info("Certifier delivery the loan details: " + loanByRenovation);
|
||||
success = true;
|
||||
} else {
|
||||
rollback();
|
||||
}
|
||||
} else {
|
||||
rollback();
|
||||
}
|
||||
getSession().save(delivery);
|
||||
}
|
||||
|
||||
flushAndClear();
|
||||
closeConnection();
|
||||
|
||||
logger.info("Certifier delivery the loan details: " + loanByRenovation);
|
||||
success = true;
|
||||
} else {
|
||||
rollback();
|
||||
}
|
||||
} else {
|
||||
rollback();
|
||||
rollback();
|
||||
}
|
||||
return success;
|
||||
} catch (Exception e) {
|
||||
} else {
|
||||
rollback();
|
||||
logger.error("updateLoanRenovationFromCerfierView", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
return success;
|
||||
} catch (Exception e) {
|
||||
rollback();
|
||||
logger.error("updateLoanRenovationFromCerfierView", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private int executeQuery(String xmlQuery, List<ModelParameter> parameters) {
|
||||
Query query = getSession().createNamedQuery(xmlQuery);
|
||||
private int executeQuery(String xmlQuery, List<ModelParameter> parameters) {
|
||||
Query query = getSession().createNamedQuery(xmlQuery);
|
||||
|
||||
parameters.forEach((param) -> {
|
||||
query.setParameter(param.getParameter(), param.getValue());
|
||||
});
|
||||
parameters.forEach((param) -> {
|
||||
query.setParameter(param.getParameter(), param.getValue());
|
||||
});
|
||||
|
||||
return query.executeUpdate();
|
||||
}
|
||||
return query.executeUpdate();
|
||||
}
|
||||
}
|
||||
|
@ -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.controller.mobile.repository.loan;
|
||||
@ -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;
|
||||
@ -31,169 +32,175 @@ import org.hibernate.query.Query;
|
||||
*/
|
||||
public class LoanDetailsRepository extends GenericRepository implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param details
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean saveLoanDetails(LoanDetails details) throws Exception {
|
||||
logger.debug("saveLoanDetails");
|
||||
try {
|
||||
return save(details);
|
||||
} catch (Exception e) {
|
||||
logger.error("saveLoanDetails", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param details
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean saveLoanDetails(LoanDetails details) throws Exception {
|
||||
logger.debug("saveLoanDetails");
|
||||
try {
|
||||
return save(details);
|
||||
} catch (Exception e) {
|
||||
logger.error("saveLoanDetails", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
public List<LoanDetails> findFeesToPayByLoanId(String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
logger.debug("findFeesToPayByLoanId");
|
||||
public List<LoanDetails> findFeesToPayByLoanId(String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
logger.debug("findFeesToPayByLoanId");
|
||||
|
||||
List<LoanDetails> results = new ArrayList<>();
|
||||
try {
|
||||
List<Tuple> tuples = xmlQueryTuple(xmlQuery, parameters);
|
||||
List<LoanDetails> results = new ArrayList<>();
|
||||
try {
|
||||
List<Tuple> tuples = xmlQueryTuple(xmlQuery, parameters);
|
||||
|
||||
tuples.forEach((tuple) -> {
|
||||
results.add(new LoanDetails(tuple.get("id", String.class), tuple.get("createdOn", Date.class), tuple.get("feeStatus", FeeStatus.class)));
|
||||
tuples.forEach((tuple) -> {
|
||||
results.add(new LoanDetails(tuple.get("id", String.class), tuple.get("createdOn", Date.class), tuple.get("feeStatus", FeeStatus.class)));
|
||||
});
|
||||
} catch (Exception e) {
|
||||
logger.error("findFeesToPayByLoanId", e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<LoanDetails> findLoanDetailsByLoanId(String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
logger.debug("findLoanDetailsByLoanId");
|
||||
|
||||
List<LoanDetails> results = new ArrayList<>();
|
||||
try {
|
||||
results = createNamedQueryResultList(LoanDetails.class, xmlQuery, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("findLoanDetailsByLoanId", e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @param loanDetails
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean updatePaidFeesStatusInLoanDetailIds(String xmlQuery, List<ModelParameter> parameters, LoanDetails loanDetails) throws Exception {
|
||||
boolean success = false;
|
||||
|
||||
Session sssn = null;
|
||||
Transaction trnsctn = null;
|
||||
try {
|
||||
sssn = HibernateUtil.getSessionFactory().getCurrentSession();
|
||||
trnsctn = sssn.beginTransaction();
|
||||
|
||||
Loan loan = sssn.get(Loan.class, loanDetails.getLoan().getId());
|
||||
|
||||
if (null != parameters && !parameters.isEmpty()) {
|
||||
Query query = sssn.createNamedQuery(xmlQuery);
|
||||
parameters.forEach((param) -> {
|
||||
query.setParameter(param.getParameter(), param.getValue());
|
||||
});
|
||||
} catch (Exception e) {
|
||||
logger.error("findFeesToPayByLoanId", e);
|
||||
throw e;
|
||||
}
|
||||
query.executeUpdate();
|
||||
logger.debug("Query update executed");
|
||||
}
|
||||
BigDecimal totalFees = loan.getAmountPaid().add(loanDetails.getPaymentAmount());
|
||||
|
||||
return results;
|
||||
}
|
||||
loanDetails.setReferenceNumber(loan.getLastReferenceNumber() + 1);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<LoanDetails> findLoanDetailsByLoanId(String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
logger.debug("findLoanDetailsByLoanId");
|
||||
sssn.save(loanDetails);
|
||||
|
||||
List<LoanDetails> results = new ArrayList<>();
|
||||
try {
|
||||
results = createNamedQueryResultList(LoanDetails.class, xmlQuery, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("findLoanDetailsByLoanId", e);
|
||||
throw e;
|
||||
}
|
||||
loan.setAmountPaid(totalFees);
|
||||
loan.setLastReferenceNumber(loan.getLastReferenceNumber() + 1);
|
||||
loan.setLastUpdatedBy(loanDetails.getCreatedBy());
|
||||
|
||||
return results;
|
||||
}
|
||||
Date date = new Date();
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
calendar.add(Calendar.HOUR_OF_DAY, -7);
|
||||
date = calendar.getTime();
|
||||
loan.setLastUpdatedOn(date);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @param loanDetails
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean updatePaidFeesStatusInLoanDetailIds(String xmlQuery, List<ModelParameter> parameters, LoanDetails loanDetails) throws Exception {
|
||||
boolean success = false;
|
||||
sssn.update(loan);
|
||||
|
||||
Session sssn = null;
|
||||
Transaction trnsctn = null;
|
||||
try {
|
||||
sssn = HibernateUtil.getSessionFactory().getCurrentSession();
|
||||
trnsctn = sssn.beginTransaction();
|
||||
trnsctn.commit();
|
||||
|
||||
Loan loan = sssn.get(Loan.class, loanDetails.getLoan().getId());
|
||||
|
||||
if (null != parameters && !parameters.isEmpty()) {
|
||||
Query query = sssn.createNamedQuery(xmlQuery);
|
||||
parameters.forEach((param) -> {
|
||||
query.setParameter(param.getParameter(), param.getValue());
|
||||
});
|
||||
query.executeUpdate();
|
||||
logger.debug("Query update executed");
|
||||
}
|
||||
BigDecimal totalFees = loan.getAmountPaid().add(loanDetails.getPaymentAmount());
|
||||
|
||||
loanDetails.setReferenceNumber(loan.getLastReferenceNumber() + 1);
|
||||
|
||||
sssn.save(loanDetails);
|
||||
|
||||
loan.setAmountPaid(totalFees);
|
||||
loan.setLastReferenceNumber(loan.getLastReferenceNumber() + 1);
|
||||
loan.setLastUpdatedBy(loanDetails.getCreatedBy());
|
||||
loan.setLastUpdatedOn(new Date());
|
||||
|
||||
sssn.update(loan);
|
||||
|
||||
trnsctn.commit();
|
||||
|
||||
logger.info("Entity updated");
|
||||
success = true;
|
||||
} catch (Exception e) {
|
||||
logger.error("Method updatePaidFeesStatusInLoanDetailIds() ", e);
|
||||
if (null != trnsctn) {
|
||||
trnsctn.rollback();
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
/* finally {
|
||||
logger.info("Entity updated");
|
||||
success = true;
|
||||
} catch (Exception e) {
|
||||
logger.error("Method updatePaidFeesStatusInLoanDetailIds() ", e);
|
||||
if (null != trnsctn) {
|
||||
trnsctn.rollback();
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
/* finally {
|
||||
if (null != sssn) {
|
||||
sssn.close();
|
||||
}
|
||||
}*/
|
||||
return success;
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param hbmQuery
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
public Long countLoandDetails(String hbmQuery, List<ModelParameter> params) {
|
||||
Long count;
|
||||
Transaction transaction = null;
|
||||
try {
|
||||
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
|
||||
transaction = session.beginTransaction();
|
||||
/**
|
||||
*
|
||||
* @param hbmQuery
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
public Long countLoandDetails(String hbmQuery, List<ModelParameter> params) {
|
||||
Long count;
|
||||
Transaction transaction = null;
|
||||
try {
|
||||
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
|
||||
transaction = session.beginTransaction();
|
||||
|
||||
Query query = session.createNamedQuery(hbmQuery);
|
||||
Query query = session.createNamedQuery(hbmQuery);
|
||||
|
||||
params.forEach((param) -> {
|
||||
query.setParameter(param.getParameter(), param.getValue());
|
||||
});
|
||||
params.forEach((param) -> {
|
||||
query.setParameter(param.getParameter(), param.getValue());
|
||||
});
|
||||
|
||||
count = (Long) query.getSingleResult();
|
||||
count = (Long) query.getSingleResult();
|
||||
|
||||
transaction.commit();
|
||||
transaction.commit();
|
||||
|
||||
return count;
|
||||
} catch (Exception e) {
|
||||
logger.error("countLoandDetails", e);
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
} catch (Exception e) {
|
||||
logger.error("countLoandDetails", e);
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param hbmQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean updateLoanDetails(String hbmQuery, List<ModelParameter> parameters) throws Exception {
|
||||
try {
|
||||
return updateCreateNamedQuery(hbmQuery, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("Method updateLoanDetails", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param hbmQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean updateLoanDetails(String hbmQuery, List<ModelParameter> parameters) throws Exception {
|
||||
try {
|
||||
return updateCreateNamedQuery(hbmQuery, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("Method updateLoanDetails", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = -6088464996350747643L;
|
||||
final Logger logger = LogManager.getLogger(LoanDetailsRepository.class);
|
||||
private static final long serialVersionUID = -6088464996350747643L;
|
||||
final Logger logger = LogManager.getLogger(LoanDetailsRepository.class);
|
||||
}
|
||||
|
@ -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>
|
||||
|
@ -113,7 +113,7 @@ public class OtherExpense implements Serializable {
|
||||
Date date = new Date();
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
calendar.add(Calendar.DAY_OF_YEAR, -1);
|
||||
calendar.add(Calendar.HOUR, -7);
|
||||
date = calendar.getTime();
|
||||
this.createdOn = date;
|
||||
}
|
||||
|
@ -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.admin;
|
||||
@ -13,8 +13,8 @@ import com.arrebol.apc.model.enums.ActionStatus;
|
||||
import com.arrebol.apc.model.enums.ActiveStatus;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@ -41,257 +41,263 @@ import org.hibernate.annotations.GenericGenerator;
|
||||
@Table(name = "APC_TRANSFER")
|
||||
public class Transfer implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -1304758262604329766L;
|
||||
private static final long serialVersionUID = -1304758262604329766L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(generator = "uuid")
|
||||
@GenericGenerator(name = "uuid", strategy = "uuid2")
|
||||
@Column(name = "id", length = 36)
|
||||
private String id;
|
||||
@Id
|
||||
@GeneratedValue(generator = "uuid")
|
||||
@GenericGenerator(name = "uuid", strategy = "uuid2")
|
||||
@Column(name = "id", length = 36)
|
||||
private String id;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY, optional = false)
|
||||
@JoinColumn(
|
||||
name = "id_user_transmitter",
|
||||
referencedColumnName = "id",
|
||||
nullable = false
|
||||
)
|
||||
private User userTransmitter;
|
||||
@ManyToOne(fetch = FetchType.LAZY, optional = false)
|
||||
@JoinColumn(
|
||||
name = "id_user_transmitter",
|
||||
referencedColumnName = "id",
|
||||
nullable = false
|
||||
)
|
||||
private User userTransmitter;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY, optional = false)
|
||||
@JoinColumn(
|
||||
name = "id_user_receiver",
|
||||
referencedColumnName = "id",
|
||||
nullable = false
|
||||
)
|
||||
private User userReceiver;
|
||||
@ManyToOne(fetch = FetchType.LAZY, optional = false)
|
||||
@JoinColumn(
|
||||
name = "id_user_receiver",
|
||||
referencedColumnName = "id",
|
||||
nullable = false
|
||||
)
|
||||
private User userReceiver;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name = "active_status", nullable = false)
|
||||
private ActiveStatus activeStatus;
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name = "active_status", nullable = false)
|
||||
private ActiveStatus activeStatus;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name = "action_status", nullable = false)
|
||||
private ActionStatus actionStatus;
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name = "action_status", nullable = false)
|
||||
private ActionStatus actionStatus;
|
||||
|
||||
@Column(name = "amount_to_transfer", nullable = false)
|
||||
private BigDecimal amountToTransfer;
|
||||
@Column(name = "amount_to_transfer", nullable = false)
|
||||
private BigDecimal amountToTransfer;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY, optional = false)
|
||||
@JoinColumn(
|
||||
name = "id_office",
|
||||
referencedColumnName = "id",
|
||||
nullable = false
|
||||
)
|
||||
private Office office;
|
||||
@ManyToOne(fetch = FetchType.LAZY, optional = false)
|
||||
@JoinColumn(
|
||||
name = "id_office",
|
||||
referencedColumnName = "id",
|
||||
nullable = false
|
||||
)
|
||||
private Office office;
|
||||
|
||||
@Column(name = "created_by", nullable = false, length = 36)
|
||||
private String createdBy;
|
||||
@Column(name = "created_by", nullable = false, length = 36)
|
||||
private String createdBy;
|
||||
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@Column(name = "created_on", length = 19)
|
||||
private Date createdOn;
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@Column(name = "created_on", length = 19)
|
||||
private Date createdOn;
|
||||
|
||||
@Column(name = "last_updated_by", length = 36)
|
||||
private String lastUpdatedBy;
|
||||
@Column(name = "last_updated_by", length = 36)
|
||||
private String lastUpdatedBy;
|
||||
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@Column(name = "last_updated_on", length = 19)
|
||||
private Date lastUpdatedOn;
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@Column(name = "last_updated_on", length = 19)
|
||||
private Date lastUpdatedOn;
|
||||
|
||||
public Transfer() {
|
||||
public Transfer() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param userTransmitter
|
||||
* @param userReceiver
|
||||
* @param activeStatus
|
||||
* @param actionStatus
|
||||
* @param amountToTransfer
|
||||
* @param office
|
||||
* @param createdBy
|
||||
*/
|
||||
public Transfer(User userTransmitter, User userReceiver, ActiveStatus activeStatus, ActionStatus actionStatus, BigDecimal amountToTransfer, Office office, String createdBy) {
|
||||
this.userTransmitter = userTransmitter;
|
||||
this.userReceiver = userReceiver;
|
||||
this.activeStatus = activeStatus;
|
||||
this.actionStatus = actionStatus;
|
||||
this.amountToTransfer = amountToTransfer;
|
||||
this.office = office;
|
||||
this.createdBy = createdBy;
|
||||
this.createdOn = new Date();
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param userTransmitter
|
||||
* @param userReceiver
|
||||
* @param activeStatus
|
||||
* @param actionStatus
|
||||
* @param amountToTransfer
|
||||
* @param office
|
||||
* @param createdBy
|
||||
*/
|
||||
public Transfer(User userTransmitter, User userReceiver, ActiveStatus activeStatus, ActionStatus actionStatus, BigDecimal amountToTransfer, Office office, String createdBy) {
|
||||
this.userTransmitter = userTransmitter;
|
||||
this.userReceiver = userReceiver;
|
||||
this.activeStatus = activeStatus;
|
||||
this.actionStatus = actionStatus;
|
||||
this.amountToTransfer = amountToTransfer;
|
||||
this.office = office;
|
||||
this.createdBy = createdBy;
|
||||
Date date = new Date();
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
calendar.add(Calendar.HOUR, -7);
|
||||
date = calendar.getTime();
|
||||
this.createdOn = date;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public Transfer(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public Transfer(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Transfer(String id, User userTransmitter, User userReceiver, ActiveStatus activeStatus, ActionStatus actionStatus, BigDecimal amountToTransfer, Office office, String createdBy) {
|
||||
this.id = id;
|
||||
this.userTransmitter = userTransmitter;
|
||||
this.userReceiver = userReceiver;
|
||||
this.activeStatus = activeStatus;
|
||||
this.actionStatus = actionStatus;
|
||||
this.amountToTransfer = amountToTransfer;
|
||||
this.office = office;
|
||||
this.createdBy = createdBy;
|
||||
this.createdOn = new Date();
|
||||
}
|
||||
public Transfer(String id, User userTransmitter, User userReceiver, ActiveStatus activeStatus, ActionStatus actionStatus, BigDecimal amountToTransfer, Office office, String createdBy) {
|
||||
this.id = id;
|
||||
this.userTransmitter = userTransmitter;
|
||||
this.userReceiver = userReceiver;
|
||||
this.activeStatus = activeStatus;
|
||||
this.actionStatus = actionStatus;
|
||||
this.amountToTransfer = amountToTransfer;
|
||||
this.office = office;
|
||||
this.createdBy = createdBy;
|
||||
this.createdOn = new Date();
|
||||
}
|
||||
|
||||
public Transfer(String id, User userTransmitter, User userReceiver, ActiveStatus activeStatus, ActionStatus actionStatus, BigDecimal amountToTransfer, Office office, String createdBy, Date createdOn) {
|
||||
this.id = id;
|
||||
this.userTransmitter = userTransmitter;
|
||||
this.userReceiver = userReceiver;
|
||||
this.activeStatus = activeStatus;
|
||||
this.actionStatus = actionStatus;
|
||||
this.amountToTransfer = amountToTransfer;
|
||||
this.office = office;
|
||||
this.createdBy = createdBy;
|
||||
this.createdOn = createdOn;
|
||||
}
|
||||
public Transfer(String id, User userTransmitter, User userReceiver, ActiveStatus activeStatus, ActionStatus actionStatus, BigDecimal amountToTransfer, Office office, String createdBy, Date createdOn) {
|
||||
this.id = id;
|
||||
this.userTransmitter = userTransmitter;
|
||||
this.userReceiver = userReceiver;
|
||||
this.activeStatus = activeStatus;
|
||||
this.actionStatus = actionStatus;
|
||||
this.amountToTransfer = amountToTransfer;
|
||||
this.office = office;
|
||||
this.createdBy = createdBy;
|
||||
this.createdOn = createdOn;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public User getUserTransmitter() {
|
||||
return userTransmitter;
|
||||
}
|
||||
public User getUserTransmitter() {
|
||||
return userTransmitter;
|
||||
}
|
||||
|
||||
public void setUserTransmitter(User userTransmitter) {
|
||||
this.userTransmitter = userTransmitter;
|
||||
}
|
||||
public void setUserTransmitter(User userTransmitter) {
|
||||
this.userTransmitter = userTransmitter;
|
||||
}
|
||||
|
||||
public User getUserReceiver() {
|
||||
return userReceiver;
|
||||
}
|
||||
public User getUserReceiver() {
|
||||
return userReceiver;
|
||||
}
|
||||
|
||||
public void setUserReceiver(User userReceiver) {
|
||||
this.userReceiver = userReceiver;
|
||||
}
|
||||
public void setUserReceiver(User userReceiver) {
|
||||
this.userReceiver = userReceiver;
|
||||
}
|
||||
|
||||
public ActiveStatus getActiveStatus() {
|
||||
return activeStatus;
|
||||
}
|
||||
public ActiveStatus getActiveStatus() {
|
||||
return activeStatus;
|
||||
}
|
||||
|
||||
public void setActiveStatus(ActiveStatus activeStatus) {
|
||||
this.activeStatus = activeStatus;
|
||||
}
|
||||
public void setActiveStatus(ActiveStatus activeStatus) {
|
||||
this.activeStatus = activeStatus;
|
||||
}
|
||||
|
||||
public ActionStatus getActionStatus() {
|
||||
return actionStatus;
|
||||
}
|
||||
public ActionStatus getActionStatus() {
|
||||
return actionStatus;
|
||||
}
|
||||
|
||||
public void setActionStatus(ActionStatus actionStatus) {
|
||||
this.actionStatus = actionStatus;
|
||||
}
|
||||
public void setActionStatus(ActionStatus actionStatus) {
|
||||
this.actionStatus = actionStatus;
|
||||
}
|
||||
|
||||
public BigDecimal getAmountToTransfer() {
|
||||
return amountToTransfer;
|
||||
}
|
||||
public BigDecimal getAmountToTransfer() {
|
||||
return amountToTransfer;
|
||||
}
|
||||
|
||||
public void setAmountToTransfer(BigDecimal amountToTransfer) {
|
||||
this.amountToTransfer = amountToTransfer;
|
||||
}
|
||||
public void setAmountToTransfer(BigDecimal amountToTransfer) {
|
||||
this.amountToTransfer = amountToTransfer;
|
||||
}
|
||||
|
||||
public String getCreatedBy() {
|
||||
return createdBy;
|
||||
}
|
||||
public String getCreatedBy() {
|
||||
return createdBy;
|
||||
}
|
||||
|
||||
public void setCreatedBy(String createdBy) {
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
public void setCreatedBy(String createdBy) {
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
|
||||
public Date getCreatedOn() {
|
||||
return createdOn;
|
||||
}
|
||||
public Date getCreatedOn() {
|
||||
return createdOn;
|
||||
}
|
||||
|
||||
public void setCreatedOn(Date createdOn) {
|
||||
this.createdOn = createdOn;
|
||||
}
|
||||
public void setCreatedOn(Date createdOn) {
|
||||
this.createdOn = createdOn;
|
||||
}
|
||||
|
||||
public String getLastUpdatedBy() {
|
||||
return lastUpdatedBy;
|
||||
}
|
||||
public String getLastUpdatedBy() {
|
||||
return lastUpdatedBy;
|
||||
}
|
||||
|
||||
public void setLastUpdatedBy(String lastUpdatedBy) {
|
||||
this.lastUpdatedBy = lastUpdatedBy;
|
||||
}
|
||||
public void setLastUpdatedBy(String lastUpdatedBy) {
|
||||
this.lastUpdatedBy = lastUpdatedBy;
|
||||
}
|
||||
|
||||
public Date getLastUpdatedOn() {
|
||||
return lastUpdatedOn;
|
||||
}
|
||||
public Date getLastUpdatedOn() {
|
||||
return lastUpdatedOn;
|
||||
}
|
||||
|
||||
public void setLastUpdatedOn(Date lastUpdatedOn) {
|
||||
this.lastUpdatedOn = lastUpdatedOn;
|
||||
}
|
||||
public void setLastUpdatedOn(Date lastUpdatedOn) {
|
||||
this.lastUpdatedOn = lastUpdatedOn;
|
||||
}
|
||||
|
||||
public Office getOffice() {
|
||||
return office;
|
||||
}
|
||||
public Office getOffice() {
|
||||
return office;
|
||||
}
|
||||
|
||||
public void setOffice(Office office) {
|
||||
this.office = office;
|
||||
}
|
||||
public void setOffice(Office office) {
|
||||
this.office = office;
|
||||
}
|
||||
|
||||
public String getUserReceiverRoutes(){
|
||||
String routes = "";
|
||||
routes = userReceiver.getHumanResource().getHumanResourceHasRoutes().stream().map((py) -> py.getRouteCtlg().getRoute()).collect(Collectors.joining(", "));
|
||||
public String getUserReceiverRoutes() {
|
||||
String routes = "";
|
||||
routes = userReceiver.getHumanResource().getHumanResourceHasRoutes().stream().map((py) -> py.getRouteCtlg().getRoute()).collect(Collectors.joining(", "));
|
||||
|
||||
return routes;
|
||||
}
|
||||
return routes;
|
||||
}
|
||||
|
||||
public String getUserTransmitterRoutes(){
|
||||
String routes = "";
|
||||
routes = userTransmitter.getHumanResource().getHumanResourceHasRoutes().stream().map((py) -> py.getRouteCtlg().getRoute()).collect(Collectors.joining(", "));
|
||||
public String getUserTransmitterRoutes() {
|
||||
String routes = "";
|
||||
routes = userTransmitter.getHumanResource().getHumanResourceHasRoutes().stream().map((py) -> py.getRouteCtlg().getRoute()).collect(Collectors.joining(", "));
|
||||
|
||||
return routes;
|
||||
}
|
||||
|
||||
public boolean getAction(Date lastStableSmallBox) {
|
||||
Date date = createdOn;
|
||||
boolean action = true;
|
||||
try {
|
||||
SimpleDateFormat dt1 = new SimpleDateFormat("yyyy-MM-dd");
|
||||
return routes;
|
||||
}
|
||||
|
||||
String dateStr = dt1.format(date);
|
||||
date = dt1.parse(dateStr);
|
||||
public boolean getAction(Date lastStableSmallBox) {
|
||||
Date date = createdOn;
|
||||
boolean action = true;
|
||||
try {
|
||||
SimpleDateFormat dt1 = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
action = date.after(lastStableSmallBox);
|
||||
String dateStr = dt1.format(date);
|
||||
date = dt1.parse(dateStr);
|
||||
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(ExpenseCompany.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
return action;
|
||||
}
|
||||
action = date.after(lastStableSmallBox);
|
||||
|
||||
public boolean getActive() {
|
||||
if (activeStatus == ActiveStatus.ENEBLED) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public String conditionEnabled() {
|
||||
if(getActiveStatus() == ActiveStatus.DISABLED)
|
||||
return "grayRow";
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Transfer{" + "activeStatus=" + activeStatus + ", actionStatus=" + actionStatus + ", createdOn=" + createdOn + '}';
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(ExpenseCompany.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
return action;
|
||||
}
|
||||
|
||||
public boolean getActive() {
|
||||
if (activeStatus == ActiveStatus.ENEBLED) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public String conditionEnabled() {
|
||||
if (getActiveStatus() == ActiveStatus.DISABLED) {
|
||||
return "grayRow";
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Transfer{" + "activeStatus=" + activeStatus + ", actionStatus=" + actionStatus + ", createdOn=" + createdOn + '}';
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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>
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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.ws.gasoline;
|
||||
@ -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;
|
||||
@ -32,45 +33,51 @@ import org.apache.logging.log4j.Logger;
|
||||
@Path("gasoline")
|
||||
public class GasolineWS implements Serializable {
|
||||
|
||||
@PUT
|
||||
@Path("save-new-gasoline-payment")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Response saveNewGasolinePayment(@FormParam("idUser") String idUser,
|
||||
@FormParam("idOffice") String idOffice,
|
||||
@FormParam("idRoute") String idRoute,
|
||||
@FormParam("total") Double total,
|
||||
@FormParam("km") Double km,
|
||||
@FormParam("quantity") Double quantity,
|
||||
@FormParam("description") String description) {
|
||||
Response response;
|
||||
try {
|
||||
GasolineController controller = new GasolineController();
|
||||
@PUT
|
||||
@Path("save-new-gasoline-payment")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Response saveNewGasolinePayment(@FormParam("idUser") String idUser,
|
||||
@FormParam("idOffice") String idOffice,
|
||||
@FormParam("idRoute") String idRoute,
|
||||
@FormParam("total") Double total,
|
||||
@FormParam("km") Double km,
|
||||
@FormParam("quantity") Double quantity,
|
||||
@FormParam("description") String description) {
|
||||
Response response;
|
||||
try {
|
||||
GasolineController controller = new GasolineController();
|
||||
|
||||
Gasoline gasoline = new Gasoline(
|
||||
UUID.randomUUID().toString(),
|
||||
new User(idUser),
|
||||
new Office(idOffice),
|
||||
new RouteCtlg(idRoute),
|
||||
quantity,
|
||||
km,
|
||||
total,
|
||||
GenericStatus.ENABLED,
|
||||
description,
|
||||
idUser,
|
||||
new Date());
|
||||
Date date = new Date();
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
calendar.add(Calendar.HOUR_OF_DAY, -7);
|
||||
date = calendar.getTime();
|
||||
|
||||
if (controller.saveNewGasolinePayment(gasoline)) {
|
||||
response = Response.ok().build();
|
||||
} else {
|
||||
response = Response.status(Response.Status.NOT_ACCEPTABLE).build();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("saveNewGasolineEntry");
|
||||
Gasoline gasoline = new Gasoline(
|
||||
UUID.randomUUID().toString(),
|
||||
new User(idUser),
|
||||
new Office(idOffice),
|
||||
new RouteCtlg(idRoute),
|
||||
quantity,
|
||||
km,
|
||||
total,
|
||||
GenericStatus.ENABLED,
|
||||
description,
|
||||
idUser,
|
||||
date);
|
||||
|
||||
if (controller.saveNewGasolinePayment(gasoline)) {
|
||||
response = Response.ok().build();
|
||||
} else {
|
||||
response = Response.status(Response.Status.NOT_ACCEPTABLE).build();
|
||||
}
|
||||
return response;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("saveNewGasolineEntry");
|
||||
response = Response.status(Response.Status.NOT_ACCEPTABLE).build();
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = -5280895557294295916L;
|
||||
final Logger logger = LogManager.getLogger(getClass());
|
||||
private static final long serialVersionUID = -5280895557294295916L;
|
||||
final Logger logger = LogManager.getLogger(getClass());
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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