/** * Methode permettant de récupérer la liste des échéances à prélever en fonction de la société et * de la date de prélèvement * * @param company Une société * @param debitDate Une date de prélèvement * @return */ public List<PaymentScheduleLine> getPaymentScheduleLineToDebit(AccountingBatch accountingBatch) { Company company = accountingBatch.getCompany(); LocalDate debitDate = accountingBatch.getDebitDate(); Currency currency = accountingBatch.getCurrency(); PaymentMode paymentMode = company.getAccountConfig().getDirectDebitPaymentMode(); List<PaymentScheduleLine> paymentScheduleLineList = paymentScheduleLineRepo .all() .filter( "self.statusSelect = ?1 AND self.paymentSchedule.statusSelect = ?2 AND self.paymentSchedule.company = ?3 " + "AND self.scheduleDate <= ?4 " + "AND self.debitBlockingOk IN ('false',null) " + "AND self.paymentSchedule.currency = ?5 " + "AND self.paymentSchedule.paymentMode = ?6 ORDER BY self.scheduleDate", PaymentScheduleLineRepository.STATUS_IN_PROGRESS, PaymentScheduleRepository.STATUS_CONFIRMED, company, debitDate, currency, paymentMode) .fetch(); if (paymentScheduleLineList.size() < 50) { log.debug( "\n Liste des échéances retenues : {} \n", this.toStringPaymentScheduleLineList(paymentScheduleLineList)); } else { log.debug("\n Nombres échéances retenues : {} \n", paymentScheduleLineList.size()); } return paymentScheduleLineList; }
/** * Méthode permettant de retrouver l'échéance rejetée qui à impliquer la création de la nouvelle * échéance * * @param paymentScheduleLine La nouvelle échéance */ public PaymentScheduleLine getPaymentScheduleLineRejectOrigin( PaymentScheduleLine paymentScheduleLine) { return paymentScheduleLineRepo .all() .filter( "self.paymentSchedule = ?1 AND self.scheduleLineSeq = ?2 AND self.statusSelect = ?3 ORDER BY self.rejectDate DESC", paymentScheduleLine.getPaymentSchedule(), paymentScheduleLine.getScheduleLineSeq(), PaymentScheduleLineRepository.STATUS_CLOSED) .fetchOne(); }