Subversion Repositories SmartDukaan

Rev

Rev 35320 | Rev 35876 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 35320 Rev 35864
Line 17... Line 17...
17
                " cast(fofoId as int), count(id))" +
17
                " cast(fofoId as int), count(id))" +
18
                " from Loan " +
18
                " from Loan " +
19
                " where fofoId in (:fofoIds) " +
19
                " where fofoId in (:fofoIds) " +
20
                " group by fofoId "),
20
                " group by fofoId "),
21
 
21
 
22
        @NamedQuery(name = "Loan.findBlockedLoans", query = "SELECT l FROM Loan l WHERE l.freeDays > 364"),
22
        @NamedQuery(name = "Loan.findBlockedLoans", query = "SELECT l FROM Loan l WHERE l.limitBlock = true"),
23
        @NamedQuery(name = "Loan.getLoansForSettlement", query = "SELECT l FROM Loan l join UserWallet  uw on uw.userId=l.fofoId WHERE uw.amount > 0 and l.freeDays < 365 and l.settledOn is null"),
23
        @NamedQuery(name = "Loan.getLoansForSettlement", query = "SELECT l FROM Loan l join UserWallet  uw on uw.userId=l.fofoId WHERE uw.amount > 0 and l.limitBlock = false and l.settledOn is null"),
24
        @NamedQuery(name = "Loan.getStateWiseLoan", query = "SELECT l FROM Loan l join FofoStore  fs on fs.id=l.fofoId join AST ast on ast.id = fs.astId join State st on st.id= ast.stateId WHERE st.name = :stateName and  l.pendingAmount > 0 and l.settledOn is null"),
24
        @NamedQuery(name = "Loan.getStateWiseLoan", query = "SELECT l FROM Loan l join FofoStore  fs on fs.id=l.fofoId join AST ast on ast.id = fs.astId join State st on st.id= ast.stateId WHERE st.name = :stateName and  l.pendingAmount > 0 and l.settledOn is null"),
25
 
25
 
26
        @NamedQuery(name = "Loan.getDueLoansByFofoId", query = "SELECT new com.spice.profitmandi.dao.model.loan.TotalLoanAmountDueModel(ls.loanId, l.pendingAmount, SUM(ls.amount)) " +
26
        @NamedQuery(name = "Loan.getDueLoansByFofoId", query = "SELECT new com.spice.profitmandi.dao.model.loan.TotalLoanAmountDueModel(ls.loanId, l.pendingAmount, SUM(ls.amount)) " +
27
                "FROM Loan l JOIN LoanStatement ls on ls.loanId=l.id " +
27
                "FROM Loan l JOIN LoanStatement ls on ls.loanId=l.id " +
28
                "WHERE l.fofoId = :fofoId AND l.pendingAmount > 0 " +
28
                "WHERE l.fofoId = :fofoId AND l.pendingAmount > 0 " +
Line 71... Line 71...
71
 
71
 
72
 
72
 
73
    @Column(name = "invoiceNumber")
73
    @Column(name = "invoiceNumber")
74
    private String invoiceNumber;
74
    private String invoiceNumber;
75
 
75
 
-
 
76
    @Column(name = "limit_block")
-
 
77
    private boolean limitBlock;
-
 
78
 
76
    @Transient
79
    @Transient
77
    private boolean loanStatus;
80
    private boolean loanStatus;
78
 
81
 
79
    @Transient
82
    @Transient
80
    private BigDecimal totalPending;
83
    private BigDecimal totalPending;
Line 101... Line 104...
101
    public boolean isDefault(LocalDate onDate) {
104
    public boolean isDefault(LocalDate onDate) {
102
        return this.getSettledOn() == null && this.getDueDate().plusDays(15).toLocalDate().isBefore(onDate);
105
        return this.getSettledOn() == null && this.getDueDate().plusDays(15).toLocalDate().isBefore(onDate);
103
    }
106
    }
104
 
107
 
105
    public boolean canBeSettled() {
108
    public boolean canBeSettled() {
106
        return this.getFreeDays() < 365 && this.settledOn == null && (this.getCdFreeDays() == 0 || this.getDays() > this.getCdFreeDays());
109
        return !this.limitBlock && this.settledOn == null && (this.getCdFreeDays() == 0 || this.getDays() > this.getCdFreeDays());
107
    }
110
    }
108
 
111
 
109
    public int getId() {
112
    public int getId() {
110
        return id;
113
        return id;
111
    }
114
    }
Line 201... Line 204...
201
    public void setDailyStatementModel(List<DailyStatementModel> dailyStatementModel) {
204
    public void setDailyStatementModel(List<DailyStatementModel> dailyStatementModel) {
202
        this.dailyStatementModel = dailyStatementModel;
205
        this.dailyStatementModel = dailyStatementModel;
203
    }
206
    }
204
 
207
 
205
    public boolean isLimit() {
208
    public boolean isLimit() {
206
        return this.getFreeDays() >= 365;
209
        return this.limitBlock;
-
 
210
    }
-
 
211
 
-
 
212
    public boolean isLimitBlock() {
-
 
213
        return limitBlock;
-
 
214
    }
-
 
215
 
-
 
216
    public void setLimitBlock(boolean limitBlock) {
-
 
217
        this.limitBlock = limitBlock;
207
    }
218
    }
208
 
219
 
209
    public String getInvoiceNumber() {
220
    public String getInvoiceNumber() {
210
        return invoiceNumber;
221
        return invoiceNumber;
211
    }
222
    }
Line 226... Line 237...
226
                ", settledOn=" + settledOn +
237
                ", settledOn=" + settledOn +
227
                ", dueDate=" + dueDate +
238
                ", dueDate=" + dueDate +
228
                ", interestAccrued=" + interestAccrued +
239
                ", interestAccrued=" + interestAccrued +
229
                ", interestPaid=" + interestPaid +
240
                ", interestPaid=" + interestPaid +
230
                ", freeDays=" + freeDays +
241
                ", freeDays=" + freeDays +
-
 
242
                ", limitBlock=" + limitBlock +
231
                ", loanStatus=" + loanStatus +
243
                ", loanStatus=" + loanStatus +
232
                ", totalPending=" + totalPending +
244
                ", totalPending=" + totalPending +
233
                ", dailyStatementModel=" + dailyStatementModel +
245
                ", dailyStatementModel=" + dailyStatementModel +
234
                '}';
246
                '}';
235
    }
247
    }
Line 237... Line 249...
237
    @Override
249
    @Override
238
    public boolean equals(Object o) {
250
    public boolean equals(Object o) {
239
        if (this == o) return true;
251
        if (this == o) return true;
240
        if (o == null || getClass() != o.getClass()) return false;
252
        if (o == null || getClass() != o.getClass()) return false;
241
        Loan loan = (Loan) o;
253
        Loan loan = (Loan) o;
242
        return id == loan.id && fofoId == loan.fofoId && freeDays == loan.freeDays && loanStatus == loan.loanStatus && Objects.equals(interestRate, loan.interestRate) && Objects.equals(intialAmount, loan.intialAmount) && Objects.equals(pendingAmount, loan.pendingAmount) && Objects.equals(createdOn, loan.createdOn) && Objects.equals(settledOn, loan.settledOn) && Objects.equals(dueDate, loan.dueDate) && Objects.equals(interestAccrued, loan.interestAccrued) && Objects.equals(interestPaid, loan.interestPaid) && Objects.equals(totalPending, loan.totalPending) && Objects.equals(dailyStatementModel, loan.dailyStatementModel);
254
        return id == loan.id && fofoId == loan.fofoId && freeDays == loan.freeDays && limitBlock == loan.limitBlock && loanStatus == loan.loanStatus && Objects.equals(interestRate, loan.interestRate) && Objects.equals(intialAmount, loan.intialAmount) && Objects.equals(pendingAmount, loan.pendingAmount) && Objects.equals(createdOn, loan.createdOn) && Objects.equals(settledOn, loan.settledOn) && Objects.equals(dueDate, loan.dueDate) && Objects.equals(interestAccrued, loan.interestAccrued) && Objects.equals(interestPaid, loan.interestPaid) && Objects.equals(totalPending, loan.totalPending) && Objects.equals(dailyStatementModel, loan.dailyStatementModel);
243
    }
255
    }
244
 
256
 
245
    @Override
257
    @Override
246
    public int hashCode() {
258
    public int hashCode() {
247
        return Objects.hash(id, fofoId, interestRate, intialAmount, pendingAmount, createdOn, settledOn, dueDate, interestAccrued, interestPaid, freeDays, loanStatus, totalPending, dailyStatementModel);
259
        return Objects.hash(id, fofoId, interestRate, intialAmount, pendingAmount, createdOn, settledOn, dueDate, interestAccrued, interestPaid, freeDays, limitBlock, loanStatus, totalPending, dailyStatementModel);
248
    }
260
    }
249
 
261
 
250
    public LocalDateTime getSettledOn() {
262
    public LocalDateTime getSettledOn() {
251
        return settledOn;
263
        return settledOn;
252
    }
264
    }