Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,6 @@ public void assembleFrom(final CodeValue collateralType, final BigDecimal value,
this.value = value;
}

public void associateWith(final Loan loan) {
this.loan = loan;
}

public static LoanCollateral fromJson(final Loan loan, final CodeValue collateralType, final JsonCommand command) {
final String description = command.stringValueOfParameterNamed(CollateralJSONinputParams.DESCRIPTION.getValue());
final BigDecimal value = command.bigDecimalValueOfParameterNamed(CollateralJSONinputParams.VALUE.getValue());
Expand Down Expand Up @@ -119,15 +115,4 @@ public CollateralData toData() {
public void setCollateralType(final CodeValue type) {
this.type = type;
}

/*
* @Override public boolean equals(final Object obj) { if (obj == null) { return false; } if (obj == this) { return
* true; } if (obj.getClass() != getClass()) { return false; } final LoanCollateral rhs = (LoanCollateral) obj;
* return new EqualsBuilder().appendSuper(super.equals(obj)) // .append(getId(), rhs.getId()) //
* .append(this.type.getId(), rhs.type.getId()) // .append(this.description, rhs.description) // .append(this.value,
* this.value)// .isEquals(); }
*
* @Override public int hashCode() { return new HashCodeBuilder(3, 5) // .append(getId()) //
* .append(this.type.getId()) // .append(this.description) // .append(this.value)// .toHashCode(); }
*/
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,14 @@
*/
package org.apache.fineract.portfolio.delinquency.domain;

import java.time.LocalDate;
import java.util.List;
import org.apache.fineract.portfolio.loanaccount.domain.Loan;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

public interface LoanDelinquencyActionRepository
extends JpaRepository<LoanDelinquencyAction, Long>, JpaSpecificationExecutor<LoanDelinquencyAction> {

@Query(value = "select da from LoanDelinquencyAction da where "
+ " ((da.action = org.apache.fineract.portfolio.delinquency.domain.DelinquencyAction.PAUSE and da.endDate is not null and :business_date >= da.startDate and :business_date <= da.endDate) or"
+ " (da.action = org.apache.fineract.portfolio.delinquency.domain.DelinquencyAction.RESUME and da.endDate is null and :business_date >= da.startDate)) and"
+ " da.loan.id = :loan_id order by da.createdDate desc")
Page<LoanDelinquencyAction> getEffectiveDelinquencyActionForLoan(@Param("loan_id") Long loan_id,
@Param("business_date") LocalDate business_date, Pageable page);

List<LoanDelinquencyAction> findByLoanOrderById(Loan loan);

}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,9 @@
public interface GLIMAccountInfoRepository
extends JpaRepository<GroupLoanIndividualMonitoringAccount, Long>, JpaSpecificationExecutor<GroupLoanIndividualMonitoringAccount> {

GroupLoanIndividualMonitoringAccount findOneByIsAcceptingChild(boolean acceptingChild);

GroupLoanIndividualMonitoringAccount findOneByIsAcceptingChildAndApplicationId(boolean acceptingChild, BigDecimal applicationId);

@Query("select loan.id from GroupLoanIndividualMonitoringAccount glim join glim.childLoan loan where glim.isAcceptingChild = :acceptingChild and glim.applicationId = :applicationId")
List<Long> findChildLoanIdsByIsAcceptingChildAndApplicationId(@Param("acceptingChild") boolean acceptingChild,
@Param("applicationId") BigDecimal applicationId);

GroupLoanIndividualMonitoringAccount findOneByAccountNumber(String accountNumber);
}
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,6 @@ List<Loan> findByClientIdAndGroupIdAndLoanStatus(@Param("clientId") Long clientI
List<Loan> findByIdsAndLoanStatusAndLoanType(@Param("ids") Collection<Long> ids,
@Param("loanStatuses") Collection<LoanStatus> loanStatuses, @Param("loanTypes") Collection<AccountType> loanTypes);

@Query("select loan.id from Loan loan where loan.actualDisbursementDate > :disbursalDate order by loan.actualDisbursementDate")
List<Long> getLoansDisbursedAfter(@Param("disbursalDate") LocalDate disbursalDate);

@Query("select loan from Loan loan where loan.client.office.id IN :officeIds and loan.loanStatus IN :loanStatuses")
List<Loan> findByClientOfficeIdsAndLoanStatus(@Param("officeIds") Collection<Long> officeIds,
@Param("loanStatuses") Collection<LoanStatus> loanStatuses);
Expand Down Expand Up @@ -280,9 +277,6 @@ List<Loan> findLoansForAddAccrual(@Param("accountingType") AccountingRuleType ac
List<COBIdAndLastClosedBusinessDate> findAllLoansBehindOnDisbursementDate(@Param("cobBusinessDate") LocalDate cobBusinessDate,
@Param("loanIds") List<Long> loanIds, @Param("loanStatuses") Collection<LoanStatus> loanStatuses);

@Query("SELECT CASE WHEN COUNT(l) > 0 THEN TRUE ELSE FALSE END FROM Loan l WHERE l.id = :loanId and l.loanRepaymentScheduleDetail.loanScheduleType = org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleType.PROGRESSIVE")
Boolean isProgressiveLoan(@Param("loanId") Long loanId);

@Query("SELECT CASE WHEN COUNT(l) > 0 THEN TRUE ELSE FALSE END FROM Loan l WHERE l.id = :loanId and l.loanStatus in :allowedLoanStatuses")
Boolean isLoanInAllowedStatus(@Param("loanId") Long loanId, @Param("allowedLoanStatuses") List<LoanStatus> allowedLoanStatuses);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,6 @@ public List<Loan> findByIdsAndLoanStatusAndLoanType(@Param("ids") Collection<Lon
return loans;
}

// This method is not used
public List<Long> getLoansDisbursedAfter(@Param("disbursalDate") LocalDate disbursalDate) {
return this.repository.getLoansDisbursedAfter(disbursalDate);
}

// Repayments Schedule
public List<Loan> findByClientOfficeIdsAndLoanStatus(@Param("officeIds") Collection<Long> officeIds,
@Param("loanStatuses") Collection<LoanStatus> loanStatuses) {
Expand Down Expand Up @@ -264,18 +259,10 @@ public Loan findNonClosedLoanByAccountNumber(@Param("accountNumber") String acco
return this.repository.findLoanByAccountNumberAndStatuses(accountNumber, NON_CLOSED_LOAN_STATUSES);
}

public boolean existsNonClosedLoanByExternalLoanId(final ExternalId externalId) {
return this.repository.existsLoanByExternalLoanIdAndStatuses(externalId, NON_CLOSED_LOAN_STATUSES);
}

public boolean existLoanByExternalId(final ExternalId externalId) {
return this.repository.existsByExternalId(externalId);
}

public List<Long> findAllNonClosedLoanIds() {
return this.repository.findAllLoanIdsByStatuses(NON_CLOSED_LOAN_STATUSES);
}

// Looks like we need complete entity
@Transactional(readOnly = true)
public Loan findNonClosedLoanThatBelongsToClient(@Param("loanId") Long loanId, @Param("clientId") Long clientId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,6 @@

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

public interface LoanTransactionRelationRepository
extends JpaRepository<LoanTransactionRelation, Long>, JpaSpecificationExecutor<LoanTransactionRelation> {

@Query("""
SELECT CASE WHEN COUNT(ltr) > 0 THEN true ELSE false END
FROM LoanTransactionRelation ltr
WHERE ltr.toTransaction = :toTransaction AND ltr.relationType = :relationType
AND ltr.fromTransaction.reversed = false
""")
boolean hasLoanTransactionRelationsWithType(LoanTransaction toTransaction, LoanTransactionRelationTypeEnum relationType);

}
extends JpaRepository<LoanTransactionRelation, Long>, JpaSpecificationExecutor<LoanTransactionRelation> {}
Loading
Loading