diff --git a/anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymentschedule/LoanRepaymentScheduleService.java b/anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymentschedule/LoanRepaymentScheduleService.java index 699e5434ef..d5597ef2c6 100644 --- a/anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymentschedule/LoanRepaymentScheduleService.java +++ b/anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymentschedule/LoanRepaymentScheduleService.java @@ -5831,6 +5831,7 @@ public class LoanRepaymentScheduleService extends MybatisBaseService 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 0) { + pd = true; plan.setPaymentInterest(L); plan.setOverdue(0); FinUncollectedReceivablesDetailedJR jr = new FinUncollectedReceivablesDetailedJR(); @@ -5865,6 +5867,7 @@ public class LoanRepaymentScheduleService extends MybatisBaseService 0) { + pd = true; plan.setOverdue(0); FinUncollectedReceivablesDetailedJR jr = new FinUncollectedReceivablesDetailedJR(); jr.setCreateBySid(userSid); @@ -5886,7 +5889,7 @@ public class LoanRepaymentScheduleService extends MybatisBaseService 0 || B.compareTo(BigDecimal.ZERO) > 0) { + if (pd) { planDetails.add(plan); } } @@ -5918,14 +5921,22 @@ public class LoanRepaymentScheduleService extends MybatisBaseService 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 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 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 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 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 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 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 0) { + pd = true; plan.setPaymentInterest(L); plan.setOverdue(0); FinUncollectedReceivablesDetailedJR jr = new FinUncollectedReceivablesDetailedJR(); @@ -6150,6 +6181,7 @@ public class LoanRepaymentScheduleService extends MybatisBaseService 0) { + pd = true; plan.setOverdue(0); FinUncollectedReceivablesDetailedJR jr = new FinUncollectedReceivablesDetailedJR(); jr.setCreateBySid(userSid); @@ -6170,7 +6202,7 @@ public class LoanRepaymentScheduleService extends MybatisBaseService 0 || B.compareTo(BigDecimal.ZERO) > 0) { + if (pd) { planDetails.add(plan); } } @@ -6220,14 +6252,22 @@ public class LoanRepaymentScheduleService extends MybatisBaseService 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 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 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 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 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 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