Browse Source

优化贷后分配资金占用费,资方逾期利息逻辑。

master
fanzongzhe 9 months ago
parent
commit
86c6520045
  1. 106
      anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymentschedule/LoanRepaymentScheduleService.java

106
anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymentschedule/LoanRepaymentScheduleService.java

@ -6026,13 +6026,18 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme
//垫款金额、垫资方逾期利息
D1 = T1.compareTo(m1i) >= 0 ? m1i : T1;
BigDecimal L1 = BigDecimal.ZERO;
if (D1.compareTo(T) >= 0) {
L1 = L;
if (T1.subtract(D1).compareTo(BigDecimal.ZERO) == 0) {
L1 = TempL;
} else {
BigDecimal bigDecimal = D1.divide(T, 2, BigDecimal.ROUND_HALF_UP);
L1 = L.multiply(bigDecimal);
if (D1.compareTo(T) >= 0) {
L1 = L;
} else {
BigDecimal bigDecimal = D1.divide(T, 2, BigDecimal.ROUND_HALF_UP);
L1 = L.multiply(bigDecimal);
}
}
T1 = T1.subtract(D1);
TempL = TempL.subtract(L1);
p.setPaymentInterest(L1);
p.setOverdue(0);
p.setPaymentMoney(D1);
@ -6054,12 +6059,17 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme
//资金占用费
temp = Q1.compareTo(m1i) >= 0 ? m1i : Q1;
BigDecimal B1 = BigDecimal.ZERO;
if (temp.compareTo(Q) >= 0) {
B1 = B;
if (Q1.subtract(temp).compareTo(BigDecimal.ZERO) == 0) {
B1 = TempB;
} else {
BigDecimal bigDecimal = temp.divide(Q, 2, BigDecimal.ROUND_HALF_UP);
B1 = B.multiply(bigDecimal);
if (temp.compareTo(Q) >= 0) {
B1 = B;
} else {
BigDecimal bigDecimal = temp.divide(Q, 2, BigDecimal.ROUND_HALF_UP);
B1 = B.multiply(bigDecimal);
}
}
TempB = TempB.subtract(B1);
if (Q1.compareTo(m1i) < 0) {
//生成 i 期还款记录,月还金额 m1i - Q1
LoanRepaymentHistory history = new LoanRepaymentHistory();
@ -6134,12 +6144,17 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme
//垫款金额、垫资方逾期利息
D1 = T1.compareTo(m2i) >= 0 ? m2i : T1;
BigDecimal L1 = BigDecimal.ZERO;
if (D1.compareTo(T) >= 0) {
L1 = L;
if (T1.subtract(D1).compareTo(BigDecimal.ZERO) == 0) {
L1 = TempL;
} else {
BigDecimal bigDecimal = D1.divide(T, 2, BigDecimal.ROUND_HALF_UP);
L1 = L.multiply(bigDecimal);
if (D1.compareTo(T) >= 0) {
L1 = L;
} else {
BigDecimal bigDecimal = D1.divide(T, 2, BigDecimal.ROUND_HALF_UP);
L1 = L.multiply(bigDecimal);
}
}
TempL = TempL.subtract(L1);
T1 = T1.subtract(D1);
p.setPaymentInterest(L1);
p.setOverdue(0);
@ -6162,12 +6177,17 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme
//资金占用费
temp = Q1.compareTo(m2i) >= 0 ? m2i : Q1;
BigDecimal B1 = BigDecimal.ZERO;
if (temp.compareTo(Q) >= 0) {
B1 = B;
if (Q1.subtract(temp).compareTo(BigDecimal.ZERO) == 0) {
B1 = TempB;
} else {
BigDecimal bigDecimal = temp.divide(Q, 2, BigDecimal.ROUND_HALF_UP);
B1 = B.multiply(bigDecimal);
if (temp.compareTo(Q) >= 0) {
B1 = B;
} else {
BigDecimal bigDecimal = temp.divide(Q, 2, BigDecimal.ROUND_HALF_UP);
B1 = B.multiply(bigDecimal);
}
}
TempB = TempB.subtract(B1);
if (Q1.compareTo(m2i) < 0) {
//生成 i 期还款记录,月还金额 m1i - Q1
LoanRepaymentHistory history = new LoanRepaymentHistory();
@ -6355,12 +6375,17 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme
//垫款金额、垫资方逾期利息
D1 = T1.compareTo(m1i) >= 0 ? m1i : T1;
BigDecimal L1 = BigDecimal.ZERO;
if (D1.compareTo(T) >= 0) {
L1 = L;
if (T1.subtract(D1).compareTo(BigDecimal.ZERO) == 0) {
L1 = TempL;
} else {
BigDecimal bigDecimal = D1.divide(T, 2, BigDecimal.ROUND_HALF_UP);
L1 = L.multiply(bigDecimal);
if (D1.compareTo(T) >= 0) {
L1 = L;
} else {
BigDecimal bigDecimal = D1.divide(T, 2, BigDecimal.ROUND_HALF_UP);
L1 = L.multiply(bigDecimal);
}
}
TempL = TempL.subtract(L1);
T1 = T1.subtract(D1);
p.setPaymentInterest(L1);
p.setOverdue(0);
@ -6383,12 +6408,17 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme
//资金占用费
temp = Q1.compareTo(m1i) >= 0 ? m1i : Q1;
BigDecimal B1 = BigDecimal.ZERO;
if (temp.compareTo(Q) >= 0) {
B1 = B;
if (Q1.subtract(temp).compareTo(BigDecimal.ZERO) == 0) {
B1 = TempB;
} else {
BigDecimal bigDecimal = temp.divide(Q, 2, BigDecimal.ROUND_HALF_UP);
B1 = B.multiply(bigDecimal);
if (temp.compareTo(Q) >= 0) {
B1 = B;
} else {
BigDecimal bigDecimal = temp.divide(Q, 2, BigDecimal.ROUND_HALF_UP);
B1 = B.multiply(bigDecimal);
}
}
TempB = TempB.subtract(B1);
if (Q1.compareTo(m1i) < 0) {
//生成 i 期还款记录,月还金额 m1i - Q1
LoanRepaymentHistory history = new LoanRepaymentHistory();
@ -6463,12 +6493,17 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme
//垫款金额、垫资方逾期利息
D1 = T1.compareTo(m2i) >= 0 ? m2i : T1;
BigDecimal L1 = BigDecimal.ZERO;
if (D1.compareTo(T) >= 0) {
L1 = L;
} else {
BigDecimal bigDecimal = D1.divide(T, 2, BigDecimal.ROUND_HALF_UP);
L1 = L.multiply(bigDecimal);
if (T1.subtract(D1).compareTo(BigDecimal.ZERO) == 0) {
L1 = TempL;
} else {
if (D1.compareTo(T) >= 0) {
L1 = L;
} else {
BigDecimal bigDecimal = D1.divide(T, 2, BigDecimal.ROUND_HALF_UP);
L1 = L.multiply(bigDecimal);
}
}
TempL = TempL.subtract(L1);
T1 = T1.subtract(D1);
p.setPaymentInterest(L1);
p.setOverdue(0);
@ -6491,12 +6526,17 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme
//资金占用费
temp = Q1.compareTo(m2i) >= 0 ? m2i : Q1;
BigDecimal B1 = BigDecimal.ZERO;
if (temp.compareTo(Q) >= 0) {
B1 = B;
if (Q1.subtract(temp).compareTo(BigDecimal.ZERO) == 0) {
B1 = TempB;
} else {
BigDecimal bigDecimal = temp.divide(Q, 2, BigDecimal.ROUND_HALF_UP);
B1 = B.multiply(bigDecimal);
if (temp.compareTo(Q) >= 0) {
B1 = B;
} else {
BigDecimal bigDecimal = temp.divide(Q, 2, BigDecimal.ROUND_HALF_UP);
B1 = B.multiply(bigDecimal);
}
}
TempB = TempB.subtract(B1);
if (Q1.compareTo(m2i) < 0) {
//生成 i 期还款记录,月还金额 m1i - Q1
LoanRepaymentHistory history = new LoanRepaymentHistory();

Loading…
Cancel
Save