|
|
@ -5831,6 +5831,7 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
List<LoanRepaymentPlanDetails> o = new ArrayList<>(); |
|
|
|
if (Q.compareTo(BigDecimal.ZERO) == 0) { |
|
|
|
for (int i = 0; i < M1; i++) { |
|
|
|
boolean pd = false; |
|
|
|
LoanRepaymentPlanDetails plan = m.get(i); |
|
|
|
LoanRepaymentHistory history = new LoanRepaymentHistory(); |
|
|
|
history.setCreateBySid(userSid); |
|
|
@ -5850,6 +5851,7 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
histories.add(history); |
|
|
|
if (i == M1 - 1) { |
|
|
|
if (L.compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
pd = true; |
|
|
|
plan.setPaymentInterest(L); |
|
|
|
plan.setOverdue(0); |
|
|
|
FinUncollectedReceivablesDetailedJR jr = new FinUncollectedReceivablesDetailedJR(); |
|
|
@ -5865,6 +5867,7 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
jrList.add(jr); |
|
|
|
} |
|
|
|
if (B.compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
pd = true; |
|
|
|
plan.setOverdue(0); |
|
|
|
FinUncollectedReceivablesDetailedJR jr = new FinUncollectedReceivablesDetailedJR(); |
|
|
|
jr.setCreateBySid(userSid); |
|
|
@ -5886,7 +5889,7 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
fundDay.setIsEnable(3); |
|
|
|
loanFundDays.add(fundDay); |
|
|
|
} |
|
|
|
if (L.compareTo(BigDecimal.ZERO) > 0 || B.compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
if (pd) { |
|
|
|
planDetails.add(plan); |
|
|
|
} |
|
|
|
} |
|
|
@ -5918,14 +5921,22 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
BigDecimal m1i = BigDecimal.ZERO; //主产品月还
|
|
|
|
BigDecimal m2i = BigDecimal.ZERO; //其他融月还
|
|
|
|
if (i <= M1) { |
|
|
|
boolean pd = false; |
|
|
|
BigDecimal temp = BigDecimal.ZERO; |
|
|
|
BigDecimal D1 = BigDecimal.ZERO; |
|
|
|
LoanRepaymentPlanDetails p = m.get(i - 1); |
|
|
|
m1i = p.getDueMoney(); |
|
|
|
if (T1.compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
pd = true; |
|
|
|
//垫款金额、垫资方逾期利息
|
|
|
|
D1 = T1.compareTo(m1i) >= 0 ? m1i : T1; |
|
|
|
BigDecimal L1 = L.multiply(D1.divide(T, BigDecimal.ROUND_CEILING)); |
|
|
|
BigDecimal L1 = BigDecimal.ZERO; |
|
|
|
if (D1.compareTo(T) >= 0) { |
|
|
|
L1 = T; |
|
|
|
} else { |
|
|
|
BigDecimal bigDecimal = D1.divide(T, 2, BigDecimal.ROUND_HALF_UP); |
|
|
|
L1 = L.multiply(bigDecimal); |
|
|
|
} |
|
|
|
T1 = T1.subtract(D1); |
|
|
|
p.setPaymentInterest(L1); |
|
|
|
p.setOverdue(0); |
|
|
@ -5944,9 +5955,16 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
} |
|
|
|
} |
|
|
|
if (Q1.compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
pd = true; |
|
|
|
//资金占用费
|
|
|
|
temp = Q1.compareTo(m1i) >= 0 ? m1i : Q1; |
|
|
|
BigDecimal B1 = B.multiply(temp.divide(Q, BigDecimal.ROUND_CEILING)); |
|
|
|
BigDecimal B1 = BigDecimal.ZERO; |
|
|
|
if (temp.compareTo(Q) >= 0) { |
|
|
|
B1 = Q; |
|
|
|
} else { |
|
|
|
BigDecimal bigDecimal = temp.divide(Q, 2, BigDecimal.ROUND_HALF_UP); |
|
|
|
B1 = B.multiply(bigDecimal); |
|
|
|
} |
|
|
|
if (Q1.compareTo(m1i) < 0) { |
|
|
|
//生成 i 期还款记录,月还金额 m1i - Q1
|
|
|
|
LoanRepaymentHistory history = new LoanRepaymentHistory(); |
|
|
@ -5988,11 +6006,7 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
loanFundDays.add(fundDay); |
|
|
|
} |
|
|
|
Q1 = Q1.subtract(temp); |
|
|
|
} |
|
|
|
if (T1.compareTo(BigDecimal.ZERO) > 0 || Q1.compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
planDetails.add(p); |
|
|
|
} |
|
|
|
if (Q1.compareTo(BigDecimal.ZERO) == 0) { |
|
|
|
} else if (Q1.compareTo(BigDecimal.ZERO) == 0) { |
|
|
|
LoanRepaymentHistory history = new LoanRepaymentHistory(); |
|
|
|
history.setCreateBySid(userSid); |
|
|
|
history.setDataTime(new Date()); |
|
|
@ -6010,16 +6024,27 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
history.setScheduleSid(schedule.getSid()); |
|
|
|
histories.add(history); |
|
|
|
} |
|
|
|
if (pd) { |
|
|
|
planDetails.add(p); |
|
|
|
} |
|
|
|
} |
|
|
|
if (i <= M2) { |
|
|
|
boolean pd = false; |
|
|
|
BigDecimal temp = BigDecimal.ZERO; |
|
|
|
BigDecimal D1 = BigDecimal.ZERO; |
|
|
|
LoanRepaymentPlanDetails p = o.get(i - 1); |
|
|
|
m2i = p.getDueMoney(); |
|
|
|
if (T1.compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
pd = true; |
|
|
|
//垫款金额、垫资方逾期利息
|
|
|
|
D1 = T1.compareTo(m2i) >= 0 ? m2i : T1; |
|
|
|
BigDecimal L1 = L.multiply(D1.divide(T, BigDecimal.ROUND_CEILING)); |
|
|
|
BigDecimal L1 = BigDecimal.ZERO; |
|
|
|
if (D1.compareTo(T) >= 0) { |
|
|
|
L1 = T; |
|
|
|
} else { |
|
|
|
BigDecimal bigDecimal = D1.divide(T, 2, BigDecimal.ROUND_HALF_UP); |
|
|
|
L1 = L.multiply(bigDecimal); |
|
|
|
} |
|
|
|
T1 = T1.subtract(D1); |
|
|
|
p.setPaymentInterest(L1); |
|
|
|
p.setOverdue(0); |
|
|
@ -6038,9 +6063,16 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
} |
|
|
|
} |
|
|
|
if (Q1.compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
pd = true; |
|
|
|
//资金占用费
|
|
|
|
temp = Q1.compareTo(m2i) >= 0 ? m2i : Q1; |
|
|
|
BigDecimal B1 = B.multiply(temp.divide(Q, BigDecimal.ROUND_CEILING)); |
|
|
|
BigDecimal B1 = BigDecimal.ZERO; |
|
|
|
if (temp.compareTo(Q) >= 0) { |
|
|
|
B1 = Q; |
|
|
|
} else { |
|
|
|
BigDecimal bigDecimal = temp.divide(Q, 2, BigDecimal.ROUND_HALF_UP); |
|
|
|
B1 = B.multiply(bigDecimal); |
|
|
|
} |
|
|
|
if (Q1.compareTo(m2i) < 0) { |
|
|
|
//生成 i 期还款记录,月还金额 m1i - Q1
|
|
|
|
LoanRepaymentHistory history = new LoanRepaymentHistory(); |
|
|
@ -6082,11 +6114,7 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
loanFundDays.add(fundDay); |
|
|
|
} |
|
|
|
Q1 = Q1.subtract(temp); |
|
|
|
} |
|
|
|
if (T1.compareTo(BigDecimal.ZERO) > 0 || Q1.compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
planDetails.add(p); |
|
|
|
} |
|
|
|
if (Q1.compareTo(BigDecimal.ZERO) == 0) { |
|
|
|
} else if (Q1.compareTo(BigDecimal.ZERO) == 0) { |
|
|
|
LoanRepaymentHistory history = new LoanRepaymentHistory(); |
|
|
|
history.setCreateBySid(userSid); |
|
|
|
history.setDataTime(new Date()); |
|
|
@ -6104,11 +6132,12 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
history.setScheduleSid(schedule.getSid()); |
|
|
|
histories.add(history); |
|
|
|
} |
|
|
|
} |
|
|
|
if (pd) { |
|
|
|
planDetails.add(p); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
@ -6117,6 +6146,7 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
List<LoanRepaymentPlanDetails> o = loanRepaymentPlanDetailsService.selByMainSidAndPolicyOrOther(schedule.getSid(), "1"); |
|
|
|
if (Q.compareTo(BigDecimal.ZERO) == 0) { |
|
|
|
for (int i = 0; i < M1; i++) { |
|
|
|
boolean pd = false; |
|
|
|
LoanRepaymentPlanDetails plan = m.get(i); |
|
|
|
LoanRepaymentHistory history = new LoanRepaymentHistory(); |
|
|
|
history.setCreateBySid(userSid); |
|
|
@ -6136,6 +6166,7 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
histories.add(history); |
|
|
|
if (i == M1 - 1) { |
|
|
|
if (L.compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
pd = true; |
|
|
|
plan.setPaymentInterest(L); |
|
|
|
plan.setOverdue(0); |
|
|
|
FinUncollectedReceivablesDetailedJR jr = new FinUncollectedReceivablesDetailedJR(); |
|
|
@ -6150,6 +6181,7 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
jrList.add(jr); |
|
|
|
} |
|
|
|
if (B.compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
pd = true; |
|
|
|
plan.setOverdue(0); |
|
|
|
FinUncollectedReceivablesDetailedJR jr = new FinUncollectedReceivablesDetailedJR(); |
|
|
|
jr.setCreateBySid(userSid); |
|
|
@ -6170,7 +6202,7 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
fundDay.setBusSid(plan.getSid()); |
|
|
|
loanFundDays.add(fundDay); |
|
|
|
} |
|
|
|
if (L.compareTo(BigDecimal.ZERO) > 0 || B.compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
if (pd) { |
|
|
|
planDetails.add(plan); |
|
|
|
} |
|
|
|
} |
|
|
@ -6220,14 +6252,22 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
BigDecimal m1i = BigDecimal.ZERO; //主产品月还
|
|
|
|
BigDecimal m2i = BigDecimal.ZERO; //其他融月还
|
|
|
|
if (i <= M1) { |
|
|
|
boolean pd = false; |
|
|
|
BigDecimal temp = BigDecimal.ZERO; |
|
|
|
BigDecimal D1 = BigDecimal.ZERO; |
|
|
|
LoanRepaymentPlanDetails p = m.get(i - 1); |
|
|
|
m1i = p.getDueMoney(); |
|
|
|
if (T1.compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
pd = true; |
|
|
|
//垫款金额、垫资方逾期利息
|
|
|
|
D1 = T1.compareTo(m1i) >= 0 ? m1i : T1; |
|
|
|
BigDecimal L1 = L.multiply(D1.divide(T, BigDecimal.ROUND_CEILING)); |
|
|
|
BigDecimal L1 = BigDecimal.ZERO; |
|
|
|
if (D1.compareTo(T) >= 0) { |
|
|
|
L1 = T; |
|
|
|
} else { |
|
|
|
BigDecimal bigDecimal = D1.divide(T, 2, BigDecimal.ROUND_HALF_UP); |
|
|
|
L1 = L.multiply(bigDecimal); |
|
|
|
} |
|
|
|
T1 = T1.subtract(D1); |
|
|
|
p.setPaymentInterest(L1); |
|
|
|
p.setOverdue(0); |
|
|
@ -6246,9 +6286,16 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
} |
|
|
|
} |
|
|
|
if (Q1.compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
pd = true; |
|
|
|
//资金占用费
|
|
|
|
temp = Q1.compareTo(m1i) >= 0 ? m1i : Q1; |
|
|
|
BigDecimal B1 = B.multiply(temp.divide(Q, BigDecimal.ROUND_CEILING)); |
|
|
|
BigDecimal B1 = BigDecimal.ZERO; |
|
|
|
if (temp.compareTo(Q) >= 0) { |
|
|
|
B1 = Q; |
|
|
|
} else { |
|
|
|
BigDecimal bigDecimal = temp.divide(Q, 2, BigDecimal.ROUND_HALF_UP); |
|
|
|
B1 = B.multiply(bigDecimal); |
|
|
|
} |
|
|
|
if (Q1.compareTo(m1i) < 0) { |
|
|
|
//生成 i 期还款记录,月还金额 m1i - Q1
|
|
|
|
LoanRepaymentHistory history = new LoanRepaymentHistory(); |
|
|
@ -6290,11 +6337,7 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
loanFundDays.add(fundDay); |
|
|
|
} |
|
|
|
Q1 = Q1.subtract(temp); |
|
|
|
} |
|
|
|
if (T1.compareTo(BigDecimal.ZERO) > 0 || Q1.compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
planDetails.add(p); |
|
|
|
} |
|
|
|
if (Q1.compareTo(BigDecimal.ZERO) == 0) { |
|
|
|
} else if (Q1.compareTo(BigDecimal.ZERO) == 0) { |
|
|
|
LoanRepaymentHistory history = new LoanRepaymentHistory(); |
|
|
|
history.setCreateBySid(userSid); |
|
|
|
history.setDataTime(new Date()); |
|
|
@ -6312,16 +6355,27 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
history.setScheduleSid(schedule.getSid()); |
|
|
|
histories.add(history); |
|
|
|
} |
|
|
|
if (true) { |
|
|
|
planDetails.add(p); |
|
|
|
} |
|
|
|
} |
|
|
|
if (i <= M2) { |
|
|
|
boolean pd = false; |
|
|
|
BigDecimal temp = BigDecimal.ZERO; |
|
|
|
BigDecimal D1 = BigDecimal.ZERO; |
|
|
|
LoanRepaymentPlanDetails p = o.get(i - 1); |
|
|
|
m2i = p.getDueMoney(); |
|
|
|
if (T1.compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
pd = true; |
|
|
|
//垫款金额、垫资方逾期利息
|
|
|
|
D1 = T1.compareTo(m2i) >= 0 ? m2i : T1; |
|
|
|
BigDecimal L1 = L.multiply(D1.divide(T, BigDecimal.ROUND_CEILING)); |
|
|
|
BigDecimal L1 = BigDecimal.ZERO; |
|
|
|
if (D1.compareTo(T) >= 0) { |
|
|
|
L1 = T; |
|
|
|
} else { |
|
|
|
BigDecimal bigDecimal = D1.divide(T, 2, BigDecimal.ROUND_HALF_UP); |
|
|
|
L1 = L.multiply(bigDecimal); |
|
|
|
} |
|
|
|
T1 = T1.subtract(D1); |
|
|
|
p.setPaymentInterest(L1); |
|
|
|
p.setOverdue(0); |
|
|
@ -6340,9 +6394,16 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
} |
|
|
|
} |
|
|
|
if (Q1.compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
pd = true; |
|
|
|
//资金占用费
|
|
|
|
temp = Q1.compareTo(m2i) >= 0 ? m2i : Q1; |
|
|
|
BigDecimal B1 = B.multiply(temp.divide(Q, BigDecimal.ROUND_CEILING)); |
|
|
|
BigDecimal B1 = BigDecimal.ZERO; |
|
|
|
if (temp.compareTo(Q) >= 0) { |
|
|
|
B1 = Q; |
|
|
|
} else { |
|
|
|
BigDecimal bigDecimal = temp.divide(Q, 2, BigDecimal.ROUND_HALF_UP); |
|
|
|
B1 = B.multiply(bigDecimal); |
|
|
|
} |
|
|
|
if (Q1.compareTo(m2i) < 0) { |
|
|
|
//生成 i 期还款记录,月还金额 m1i - Q1
|
|
|
|
LoanRepaymentHistory history = new LoanRepaymentHistory(); |
|
|
@ -6384,11 +6445,7 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
loanFundDays.add(fundDay); |
|
|
|
} |
|
|
|
Q1 = Q1.subtract(temp); |
|
|
|
} |
|
|
|
if (T1.compareTo(BigDecimal.ZERO) > 0 || Q1.compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
planDetails.add(p); |
|
|
|
} |
|
|
|
if (Q1.compareTo(BigDecimal.ZERO) == 0) { |
|
|
|
} else if (Q1.compareTo(BigDecimal.ZERO) == 0) { |
|
|
|
LoanRepaymentHistory history = new LoanRepaymentHistory(); |
|
|
|
history.setCreateBySid(userSid); |
|
|
|
history.setDataTime(new Date()); |
|
|
@ -6406,6 +6463,10 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
history.setScheduleSid(schedule.getSid()); |
|
|
|
histories.add(history); |
|
|
|
} |
|
|
|
if (pd) { |
|
|
|
planDetails.add(p); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|