From 9ca83ba1d681b047745f496a1ec015eff28e8f7d Mon Sep 17 00:00:00 2001
From: fanzongzhe <285169773@qq.com>
Date: Fri, 19 Jul 2024 10:53:25 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B4=B7=E5=90=8E=E6=95=B0?=
=?UTF-8?q?=E6=8D=AE=E5=AF=BC=E5=85=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../LoanRepaymentSchedule.java | 2 +
.../LoanRepaymentHistoryMapper.xml | 15 +-
.../LoanRepaymentScheduleMapper.xml | 4 +-
.../LoanRepaymentScheduleService.java | 827 +++++++++---------
4 files changed, 420 insertions(+), 428 deletions(-)
diff --git a/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymentschedule/LoanRepaymentSchedule.java b/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymentschedule/LoanRepaymentSchedule.java
index 09de90a53c..62aed25146 100644
--- a/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymentschedule/LoanRepaymentSchedule.java
+++ b/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymentschedule/LoanRepaymentSchedule.java
@@ -96,4 +96,6 @@ public class LoanRepaymentSchedule extends BaseEntity {
private BigDecimal importInterest;
@ApiModelProperty("导入资金占用费")
private BigDecimal importFund;
+ @ApiModelProperty("全路径")
+ private String orgSidPath;
}
diff --git a/anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymenthistory/LoanRepaymentHistoryMapper.xml b/anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymenthistory/LoanRepaymentHistoryMapper.xml
index fb76265a3c..7f8463dd53 100644
--- a/anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymenthistory/LoanRepaymentHistoryMapper.xml
+++ b/anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymenthistory/LoanRepaymentHistoryMapper.xml
@@ -284,8 +284,8 @@
SELECT
pd.busVinSid,
pd.dueDate,
- s.createBySid,
- s.orgSidPath,
+ pd.createBySid,
+ pd.orgSidPath,
pd.sid,
pd.useOrgName,
pd.dept,
@@ -314,7 +314,6 @@
END AS returnState
FROM
loan_repayment_plan_details AS pd
- LEFT JOIN anrui_buscenter.bus_sales_order AS s ON s.sid = pd.salesOrderSid
LEFT JOIN (
SELECT
p.sid,
@@ -432,8 +431,8 @@
(
SELECT
pd.dueDate,
- s.createBySid,
- s.orgSidPath,
+ pd.createBySid,
+ pd.orgSidPath,
pd.sid,
pd.useOrgName,
pd.dept,
@@ -461,7 +460,6 @@
END AS returnState
FROM
loan_repayment_plan_details AS pd
- LEFT JOIN anrui_buscenter.bus_sales_order AS s ON s.sid = pd.salesOrderSid
LEFT JOIN loan_be_padsincere_veh AS v ON v.saleVehSid = pd.busVinSid
LEFT JOIN (
SELECT
@@ -674,8 +672,8 @@
SELECT
pd.busVinSid,
pd.dueDate,
- s.createBySid,
- s.orgSidPath,
+ pd.createBySid,
+ pd.orgSidPath,
pd.sid,
pd.useOrgName,
pd.dept,
@@ -707,7 +705,6 @@
END AS returnState
FROM
loan_repayment_plan_details AS pd
- LEFT JOIN anrui_buscenter.bus_sales_order AS s ON s.sid = pd.salesOrderSid
LEFT JOIN (
SELECT
p.sid,
diff --git a/anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymentschedule/LoanRepaymentScheduleMapper.xml b/anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymentschedule/LoanRepaymentScheduleMapper.xml
index f35a6981cf..daf4d37be1 100644
--- a/anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymentschedule/LoanRepaymentScheduleMapper.xml
+++ b/anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymentschedule/LoanRepaymentScheduleMapper.xml
@@ -6,7 +6,7 @@
vehCount,vinNo,loanContractSid,loanContractNo,bankContractNo,bankName,policyName,mainPeriod,mainRepayDate,
mainLastDate,mainFirstRepay,mainMidRepay,mainLastRepay,otherPeriod,otherBankNo,otherRepayDate,otherFirstRepay,
otherMidRepay,otherLastRepay,isOtherPolicy,sameBank,cwDeptNo,isDifferent,importTiredMoney,importPaymentMoney,
- importInterest,importFund)
+ importInterest,importFund,orgSidPath)
values
(#{item.createBySid},#{item.sid},#{item.createTime},#{item.isEnable},#{item.salesOrderSid},#{item.borrowerSid},#{item.borrowerName},
@@ -14,7 +14,7 @@
#{item.policyName},#{item.mainPeriod},#{item.mainRepayDate},#{item.mainLastDate},#{item.mainFirstRepay},#{item.mainMidRepay},
#{item.mainLastRepay},#{item.otherPeriod},#{item.otherBankNo},#{item.otherRepayDate},#{item.otherFirstRepay},#{item.otherMidRepay},
#{item.otherLastRepay},#{item.isOtherPolicy},#{item.sameBank},#{item.cwDeptNo},#{item.isDifferent},#{item.importTiredMoney},
- #{item.importPaymentMoney},#{item.importInterest},#{item.importFund}
+ #{item.importPaymentMoney},#{item.importInterest},#{item.importFund},#{item.orgSidPath}
)
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 4b3d6598d6..1f39d29e4e 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
@@ -5257,6 +5257,7 @@ public class LoanRepaymentScheduleService extends MybatisBaseService 0; i--) {
- 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 = BigDecimal.ZERO;
- if (T1.subtract(D1).compareTo(BigDecimal.ZERO) == 0) {
- L1 = TempL;
+ int M = maxInt(M1, M2); //取最大还款期数
+ for (int i = M; i <= M && i > 0; i--) {
+ 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 = BigDecimal.ZERO;
+ if (T1.subtract(D1).compareTo(BigDecimal.ZERO) == 0) {
+ L1 = TempL;
+ } else {
+ if (D1.compareTo(T) >= 0) {
+ L1 = L;
} else {
- 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);
- if (L1.compareTo(BigDecimal.ZERO) > 0) {
- FinUncollectedReceivablesDetailedJR jr = new FinUncollectedReceivablesDetailedJR();
- jr.setCreateBySid(userSid);
- jr.setBusSid(p.getSid());
- jr.setKxState("01");
- jr.setIsEnable(3);
- jr.setReveivableMoney(L1);
- jr.setCurrentReceivableMoney(L1);
- jr.setPayCostTitleKey("005");
- jr.setPayCostTitleValue("资方逾期利息");
- jrList.add(jr);
+ BigDecimal bigDecimal = D1.divide(T, 2, BigDecimal.ROUND_HALF_UP);
+ L1 = L.multiply(bigDecimal);
}
}
- if (Q1.compareTo(BigDecimal.ZERO) > 0) {
- pd = true;
- //资金占用费
- temp = Q1.compareTo(m1i) >= 0 ? m1i : Q1;
- BigDecimal B1 = BigDecimal.ZERO;
- if (Q1.subtract(temp).compareTo(BigDecimal.ZERO) == 0) {
- B1 = TempB;
+ T1 = T1.subtract(D1);
+ TempL = TempL.subtract(L1);
+ p.setPaymentInterest(L1);
+ p.setOverdue(0);
+ p.setPaymentMoney(D1);
+ if (L1.compareTo(BigDecimal.ZERO) > 0) {
+ FinUncollectedReceivablesDetailedJR jr = new FinUncollectedReceivablesDetailedJR();
+ jr.setCreateBySid(userSid);
+ jr.setBusSid(p.getSid());
+ jr.setKxState("01");
+ jr.setIsEnable(3);
+ jr.setReveivableMoney(L1);
+ jr.setCurrentReceivableMoney(L1);
+ jr.setPayCostTitleKey("005");
+ jr.setPayCostTitleValue("资方逾期利息");
+ jrList.add(jr);
+ }
+ }
+ if (Q1.compareTo(BigDecimal.ZERO) > 0) {
+ pd = true;
+ //资金占用费
+ temp = Q1.compareTo(m1i) >= 0 ? m1i : Q1;
+ BigDecimal B1 = BigDecimal.ZERO;
+ if (Q1.subtract(temp).compareTo(BigDecimal.ZERO) == 0) {
+ B1 = TempB;
+ } else {
+ if (temp.compareTo(Q) >= 0) {
+ B1 = B;
} else {
- if (temp.compareTo(Q) >= 0) {
- B1 = B;
- } else {
- BigDecimal bigDecimal = temp.divide(Q, 2, BigDecimal.ROUND_HALF_UP);
- B1 = B.multiply(bigDecimal);
- }
+ 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();
- history.setCreateBySid(userSid);
- history.setDataTime(new Date());
- history.setUpdateState("1");
- history.setUpdateTime(new Date());
- history.setActualDate(p.getDueDate());
- history.setActualMoney(m1i.subtract(Q1));
- history.setBuckleKey("003");
- history.setBuckle("审核通过");
- history.setReturnWayKey("01");
- history.setReturnWay("直还");
- history.setPayState(0);
- history.setIsEnable(3);
- history.setPlanDetailSid(p.getSid());
- history.setScheduleSid(schedule.getSid());
- histories.add(history);
- }
- p.setOverdue(0);
- if (B1.compareTo(BigDecimal.ZERO) > 0) {
- FinUncollectedReceivablesDetailedJR jr = new FinUncollectedReceivablesDetailedJR();
- jr.setCreateBySid(userSid);
- jr.setBusSid(p.getSid());
- jr.setKxState("01");
- jr.setIsEnable(3);
- jr.setReveivableMoney(B1);
- jr.setCurrentReceivableMoney(B1);
- jr.setPayCostTitleKey("006");
- jr.setPayCostTitleValue("资金占用费");
- jrList.add(jr);
- LoanFundDay fundDay = new LoanFundDay();
- fundDay.setCreateBySid(userSid);
- fundDay.setIsEnable(3);
- fundDay.setCreateDate(returnYesterday());
- fundDay.setPaymentMoney(p.getPaymentMoney());
- fundDay.setFund(B1);
- fundDay.setBusSid(p.getSid());
- loanFundDays.add(fundDay);
- }
- Q1 = Q1.subtract(temp);
- } else if (Q1.compareTo(BigDecimal.ZERO) == 0) {
+ }
+ TempB = TempB.subtract(B1);
+ if (Q1.compareTo(m1i) < 0) {
+ //生成 i 期还款记录,月还金额 m1i - Q1
LoanRepaymentHistory history = new LoanRepaymentHistory();
history.setCreateBySid(userSid);
history.setDataTime(new Date());
history.setUpdateState("1");
history.setUpdateTime(new Date());
history.setActualDate(p.getDueDate());
- history.setActualMoney(p.getDueMoney());
+ history.setActualMoney(m1i.subtract(Q1));
history.setBuckleKey("003");
history.setBuckle("审核通过");
history.setReturnWayKey("01");
@@ -6129,114 +6082,114 @@ public class LoanRepaymentScheduleService extends MybatisBaseService 0) {
- pd = true;
- //垫款金额、垫资方逾期利息
- D1 = T1.compareTo(m2i) >= 0 ? m2i : T1;
- BigDecimal L1 = BigDecimal.ZERO;
- if (T1.subtract(D1).compareTo(BigDecimal.ZERO) == 0) {
- L1 = TempL;
+ p.setOverdue(0);
+ if (B1.compareTo(BigDecimal.ZERO) > 0) {
+ FinUncollectedReceivablesDetailedJR jr = new FinUncollectedReceivablesDetailedJR();
+ jr.setCreateBySid(userSid);
+ jr.setBusSid(p.getSid());
+ jr.setKxState("01");
+ jr.setIsEnable(3);
+ jr.setReveivableMoney(B1);
+ jr.setCurrentReceivableMoney(B1);
+ jr.setPayCostTitleKey("006");
+ jr.setPayCostTitleValue("资金占用费");
+ jrList.add(jr);
+ LoanFundDay fundDay = new LoanFundDay();
+ fundDay.setCreateBySid(userSid);
+ fundDay.setIsEnable(3);
+ fundDay.setCreateDate(returnYesterday());
+ fundDay.setPaymentMoney(p.getPaymentMoney());
+ fundDay.setFund(B1);
+ fundDay.setBusSid(p.getSid());
+ loanFundDays.add(fundDay);
+ }
+ Q1 = Q1.subtract(temp);
+ } else if (Q1.compareTo(BigDecimal.ZERO) == 0) {
+ LoanRepaymentHistory history = new LoanRepaymentHistory();
+ history.setCreateBySid(userSid);
+ history.setDataTime(new Date());
+ history.setUpdateState("1");
+ history.setUpdateTime(new Date());
+ history.setActualDate(p.getDueDate());
+ history.setActualMoney(p.getDueMoney());
+ history.setBuckleKey("003");
+ history.setBuckle("审核通过");
+ history.setReturnWayKey("01");
+ history.setReturnWay("直还");
+ history.setPayState(0);
+ history.setIsEnable(3);
+ history.setPlanDetailSid(p.getSid());
+ 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 = BigDecimal.ZERO;
+ if (T1.subtract(D1).compareTo(BigDecimal.ZERO) == 0) {
+ L1 = TempL;
+ } else {
+ if (D1.compareTo(T) >= 0) {
+ L1 = L;
} 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);
- p.setPaymentMoney(D1);
- if (L1.compareTo(BigDecimal.ZERO) > 0) {
- FinUncollectedReceivablesDetailedJR jr = new FinUncollectedReceivablesDetailedJR();
- jr.setCreateBySid(userSid);
- jr.setBusSid(p.getSid());
- jr.setKxState("01");
- jr.setIsEnable(3);
- jr.setReveivableMoney(L1);
- jr.setCurrentReceivableMoney(L1);
- jr.setPayCostTitleKey("005");
- jr.setPayCostTitleValue("资方逾期利息");
- jrList.add(jr);
+ BigDecimal bigDecimal = D1.divide(T, 2, BigDecimal.ROUND_HALF_UP);
+ L1 = L.multiply(bigDecimal);
}
}
- if (Q1.compareTo(BigDecimal.ZERO) > 0) {
- pd = true;
- //资金占用费
- temp = Q1.compareTo(m2i) >= 0 ? m2i : Q1;
- BigDecimal B1 = BigDecimal.ZERO;
- if (Q1.subtract(temp).compareTo(BigDecimal.ZERO) == 0) {
- B1 = TempB;
+ TempL = TempL.subtract(L1);
+ T1 = T1.subtract(D1);
+ p.setPaymentInterest(L1);
+ p.setOverdue(0);
+ p.setPaymentMoney(D1);
+ if (L1.compareTo(BigDecimal.ZERO) > 0) {
+ FinUncollectedReceivablesDetailedJR jr = new FinUncollectedReceivablesDetailedJR();
+ jr.setCreateBySid(userSid);
+ jr.setBusSid(p.getSid());
+ jr.setKxState("01");
+ jr.setIsEnable(3);
+ jr.setReveivableMoney(L1);
+ jr.setCurrentReceivableMoney(L1);
+ jr.setPayCostTitleKey("005");
+ jr.setPayCostTitleValue("资方逾期利息");
+ jrList.add(jr);
+ }
+ }
+ if (Q1.compareTo(BigDecimal.ZERO) > 0) {
+ pd = true;
+ //资金占用费
+ temp = Q1.compareTo(m2i) >= 0 ? m2i : Q1;
+ BigDecimal B1 = BigDecimal.ZERO;
+ if (Q1.subtract(temp).compareTo(BigDecimal.ZERO) == 0) {
+ B1 = TempB;
+ } else {
+ if (temp.compareTo(Q) >= 0) {
+ B1 = B;
} else {
- 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();
- history.setCreateBySid(userSid);
- history.setDataTime(new Date());
- history.setUpdateState("1");
- history.setUpdateTime(new Date());
- history.setActualDate(p.getDueDate());
- history.setActualMoney(m2i.subtract(Q1));
- history.setBuckleKey("003");
- history.setBuckle("审核通过");
- history.setReturnWayKey("01");
- history.setReturnWay("直还");
- history.setPayState(0);
- history.setIsEnable(3);
- history.setPlanDetailSid(p.getSid());
- history.setScheduleSid(schedule.getSid());
- histories.add(history);
+ BigDecimal bigDecimal = temp.divide(Q, 2, BigDecimal.ROUND_HALF_UP);
+ B1 = B.multiply(bigDecimal);
}
- p.setOverdue(0);
- if (B1.compareTo(BigDecimal.ZERO) > 0) {
- FinUncollectedReceivablesDetailedJR jr = new FinUncollectedReceivablesDetailedJR();
- jr.setCreateBySid(userSid);
- jr.setBusSid(p.getSid());
- jr.setKxState("01");
- jr.setIsEnable(3);
- jr.setReveivableMoney(B1);
- jr.setCurrentReceivableMoney(B1);
- jr.setPayCostTitleKey("006");
- jr.setPayCostTitleValue("资金占用费");
- jrList.add(jr);
- LoanFundDay fundDay = new LoanFundDay();
- fundDay.setCreateBySid(userSid);
- fundDay.setIsEnable(3);
- fundDay.setCreateDate(returnYesterday());
- fundDay.setPaymentMoney(p.getPaymentMoney());
- fundDay.setFund(B1);
- fundDay.setBusSid(p.getSid());
- loanFundDays.add(fundDay);
- }
- Q1 = Q1.subtract(temp);
- } else if (Q1.compareTo(BigDecimal.ZERO) == 0) {
+ }
+ TempB = TempB.subtract(B1);
+ if (Q1.compareTo(m2i) < 0) {
+ //生成 i 期还款记录,月还金额 m1i - Q1
LoanRepaymentHistory history = new LoanRepaymentHistory();
history.setCreateBySid(userSid);
history.setDataTime(new Date());
history.setUpdateState("1");
history.setUpdateTime(new Date());
history.setActualDate(p.getDueDate());
- history.setActualMoney(p.getDueMoney());
+ history.setActualMoney(m2i.subtract(Q1));
history.setBuckleKey("003");
history.setBuckle("审核通过");
history.setReturnWayKey("01");
@@ -6247,12 +6200,52 @@ public class LoanRepaymentScheduleService extends MybatisBaseService 0) {
+ FinUncollectedReceivablesDetailedJR jr = new FinUncollectedReceivablesDetailedJR();
+ jr.setCreateBySid(userSid);
+ jr.setBusSid(p.getSid());
+ jr.setKxState("01");
+ jr.setIsEnable(3);
+ jr.setReveivableMoney(B1);
+ jr.setCurrentReceivableMoney(B1);
+ jr.setPayCostTitleKey("006");
+ jr.setPayCostTitleValue("资金占用费");
+ jrList.add(jr);
+ LoanFundDay fundDay = new LoanFundDay();
+ fundDay.setCreateBySid(userSid);
+ fundDay.setIsEnable(3);
+ fundDay.setCreateDate(returnYesterday());
+ fundDay.setPaymentMoney(p.getPaymentMoney());
+ fundDay.setFund(B1);
+ fundDay.setBusSid(p.getSid());
+ loanFundDays.add(fundDay);
+ }
+ Q1 = Q1.subtract(temp);
+ } else if (Q1.compareTo(BigDecimal.ZERO) == 0) {
+ LoanRepaymentHistory history = new LoanRepaymentHistory();
+ history.setCreateBySid(userSid);
+ history.setDataTime(new Date());
+ history.setUpdateState("1");
+ history.setUpdateTime(new Date());
+ history.setActualDate(p.getDueDate());
+ history.setActualMoney(p.getDueMoney());
+ history.setBuckleKey("003");
+ history.setBuckle("审核通过");
+ history.setReturnWayKey("01");
+ history.setReturnWay("直还");
+ history.setPayState(0);
+ history.setIsEnable(3);
+ history.setPlanDetailSid(p.getSid());
+ history.setScheduleSid(schedule.getSid());
+ histories.add(history);
}
+ if (pd) {
+ planDetails.add(p);
+ }
+
}
+ }
}
} else {
M2 = getDiffPeriod(new Date(), schedule.getOtherRepayDate());
@@ -6360,114 +6353,74 @@ public class LoanRepaymentScheduleService extends MybatisBaseService 0; i--) {
- 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 = BigDecimal.ZERO;
- if (T1.subtract(D1).compareTo(BigDecimal.ZERO) == 0) {
- L1 = TempL;
+ int M = maxInt(M1, M2); //取最大还款期数
+ for (int i = M; i <= M && i > 0; i--) {
+ 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 = BigDecimal.ZERO;
+ if (T1.subtract(D1).compareTo(BigDecimal.ZERO) == 0) {
+ L1 = TempL;
+ } else {
+ if (D1.compareTo(T) >= 0) {
+ L1 = L;
} 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);
- p.setPaymentMoney(D1);
- if (L1.compareTo(BigDecimal.ZERO) > 0) {
- FinUncollectedReceivablesDetailedJR jr = new FinUncollectedReceivablesDetailedJR();
- jr.setCreateBySid(userSid);
- jr.setBusSid(p.getSid());
- jr.setKxState("01");
- jr.setIsEnable(3);
- jr.setReveivableMoney(L1);
- jr.setCurrentReceivableMoney(L1);
- jr.setPayCostTitleKey("005");
- jr.setPayCostTitleValue("资方逾期利息");
- jrList.add(jr);
+ BigDecimal bigDecimal = D1.divide(T, 2, BigDecimal.ROUND_HALF_UP);
+ L1 = L.multiply(bigDecimal);
}
}
- if (Q1.compareTo(BigDecimal.ZERO) > 0) {
- pd = true;
- //资金占用费
- temp = Q1.compareTo(m1i) >= 0 ? m1i : Q1;
- BigDecimal B1 = BigDecimal.ZERO;
- if (Q1.subtract(temp).compareTo(BigDecimal.ZERO) == 0) {
- B1 = TempB;
+ TempL = TempL.subtract(L1);
+ T1 = T1.subtract(D1);
+ p.setPaymentInterest(L1);
+ p.setOverdue(0);
+ p.setPaymentMoney(D1);
+ if (L1.compareTo(BigDecimal.ZERO) > 0) {
+ FinUncollectedReceivablesDetailedJR jr = new FinUncollectedReceivablesDetailedJR();
+ jr.setCreateBySid(userSid);
+ jr.setBusSid(p.getSid());
+ jr.setKxState("01");
+ jr.setIsEnable(3);
+ jr.setReveivableMoney(L1);
+ jr.setCurrentReceivableMoney(L1);
+ jr.setPayCostTitleKey("005");
+ jr.setPayCostTitleValue("资方逾期利息");
+ jrList.add(jr);
+ }
+ }
+ if (Q1.compareTo(BigDecimal.ZERO) > 0) {
+ pd = true;
+ //资金占用费
+ temp = Q1.compareTo(m1i) >= 0 ? m1i : Q1;
+ BigDecimal B1 = BigDecimal.ZERO;
+ if (Q1.subtract(temp).compareTo(BigDecimal.ZERO) == 0) {
+ B1 = TempB;
+ } else {
+ if (temp.compareTo(Q) >= 0) {
+ B1 = B;
} else {
- 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();
- history.setCreateBySid(userSid);
- history.setDataTime(new Date());
- history.setUpdateState("1");
- history.setUpdateTime(new Date());
- history.setActualDate(p.getDueDate());
- history.setActualMoney(m1i.subtract(Q1));
- history.setBuckleKey("003");
- history.setBuckle("审核通过");
- history.setReturnWayKey("01");
- history.setReturnWay("直还");
- history.setPayState(0);
- history.setIsEnable(3);
- history.setPlanDetailSid(p.getSid());
- history.setScheduleSid(schedule.getSid());
- histories.add(history);
+ BigDecimal bigDecimal = temp.divide(Q, 2, BigDecimal.ROUND_HALF_UP);
+ B1 = B.multiply(bigDecimal);
}
- p.setOverdue(0);
- if (B1.compareTo(BigDecimal.ZERO) > 0) {
- FinUncollectedReceivablesDetailedJR jr = new FinUncollectedReceivablesDetailedJR();
- jr.setCreateBySid(userSid);
- jr.setBusSid(p.getSid());
- jr.setKxState("01");
- jr.setIsEnable(3);
- jr.setReveivableMoney(B1);
- jr.setCurrentReceivableMoney(B1);
- jr.setPayCostTitleKey("006");
- jr.setPayCostTitleValue("资金占用费");
- jrList.add(jr);
- LoanFundDay fundDay = new LoanFundDay();
- fundDay.setCreateBySid(userSid);
- fundDay.setIsEnable(3);
- fundDay.setCreateDate(returnYesterday());
- fundDay.setPaymentMoney(p.getPaymentMoney());
- fundDay.setFund(B1);
- fundDay.setBusSid(p.getSid());
- loanFundDays.add(fundDay);
- }
- Q1 = Q1.subtract(temp);
- } else if (Q1.compareTo(BigDecimal.ZERO) == 0) {
+ }
+ TempB = TempB.subtract(B1);
+ if (Q1.compareTo(m1i) < 0) {
+ //生成 i 期还款记录,月还金额 m1i - Q1
LoanRepaymentHistory history = new LoanRepaymentHistory();
history.setCreateBySid(userSid);
history.setDataTime(new Date());
history.setUpdateState("1");
history.setUpdateTime(new Date());
history.setActualDate(p.getDueDate());
- history.setActualMoney(p.getDueMoney());
+ history.setActualMoney(m1i.subtract(Q1));
history.setBuckleKey("003");
history.setBuckle("审核通过");
history.setReturnWayKey("01");
@@ -6478,114 +6431,114 @@ public class LoanRepaymentScheduleService extends MybatisBaseService 0) {
- pd = true;
- //垫款金额、垫资方逾期利息
- D1 = T1.compareTo(m2i) >= 0 ? m2i : T1;
- BigDecimal L1 = BigDecimal.ZERO;
- 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);
- p.setPaymentMoney(D1);
- if (L1.compareTo(BigDecimal.ZERO) > 0) {
- FinUncollectedReceivablesDetailedJR jr = new FinUncollectedReceivablesDetailedJR();
- jr.setCreateBySid(userSid);
- jr.setBusSid(p.getSid());
- jr.setKxState("01");
- jr.setIsEnable(3);
- jr.setReveivableMoney(L1);
- jr.setCurrentReceivableMoney(L1);
- jr.setPayCostTitleKey("005");
- jr.setPayCostTitleValue("资方逾期利息");
- jrList.add(jr);
+ p.setOverdue(0);
+ if (B1.compareTo(BigDecimal.ZERO) > 0) {
+ FinUncollectedReceivablesDetailedJR jr = new FinUncollectedReceivablesDetailedJR();
+ jr.setCreateBySid(userSid);
+ jr.setBusSid(p.getSid());
+ jr.setKxState("01");
+ jr.setIsEnable(3);
+ jr.setReveivableMoney(B1);
+ jr.setCurrentReceivableMoney(B1);
+ jr.setPayCostTitleKey("006");
+ jr.setPayCostTitleValue("资金占用费");
+ jrList.add(jr);
+ LoanFundDay fundDay = new LoanFundDay();
+ fundDay.setCreateBySid(userSid);
+ fundDay.setIsEnable(3);
+ fundDay.setCreateDate(returnYesterday());
+ fundDay.setPaymentMoney(p.getPaymentMoney());
+ fundDay.setFund(B1);
+ fundDay.setBusSid(p.getSid());
+ loanFundDays.add(fundDay);
+ }
+ Q1 = Q1.subtract(temp);
+ } else if (Q1.compareTo(BigDecimal.ZERO) == 0) {
+ LoanRepaymentHistory history = new LoanRepaymentHistory();
+ history.setCreateBySid(userSid);
+ history.setDataTime(new Date());
+ history.setUpdateState("1");
+ history.setUpdateTime(new Date());
+ history.setActualDate(p.getDueDate());
+ history.setActualMoney(p.getDueMoney());
+ history.setBuckleKey("003");
+ history.setBuckle("审核通过");
+ history.setReturnWayKey("01");
+ history.setReturnWay("直还");
+ history.setPayState(0);
+ history.setIsEnable(3);
+ history.setPlanDetailSid(p.getSid());
+ 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 = BigDecimal.ZERO;
+ 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);
}
}
- if (Q1.compareTo(BigDecimal.ZERO) > 0) {
- pd = true;
- //资金占用费
- temp = Q1.compareTo(m2i) >= 0 ? m2i : Q1;
- BigDecimal B1 = BigDecimal.ZERO;
- if (Q1.subtract(temp).compareTo(BigDecimal.ZERO) == 0) {
- B1 = TempB;
+ TempL = TempL.subtract(L1);
+ T1 = T1.subtract(D1);
+ p.setPaymentInterest(L1);
+ p.setOverdue(0);
+ p.setPaymentMoney(D1);
+ if (L1.compareTo(BigDecimal.ZERO) > 0) {
+ FinUncollectedReceivablesDetailedJR jr = new FinUncollectedReceivablesDetailedJR();
+ jr.setCreateBySid(userSid);
+ jr.setBusSid(p.getSid());
+ jr.setKxState("01");
+ jr.setIsEnable(3);
+ jr.setReveivableMoney(L1);
+ jr.setCurrentReceivableMoney(L1);
+ jr.setPayCostTitleKey("005");
+ jr.setPayCostTitleValue("资方逾期利息");
+ jrList.add(jr);
+ }
+ }
+ if (Q1.compareTo(BigDecimal.ZERO) > 0) {
+ pd = true;
+ //资金占用费
+ temp = Q1.compareTo(m2i) >= 0 ? m2i : Q1;
+ BigDecimal B1 = BigDecimal.ZERO;
+ if (Q1.subtract(temp).compareTo(BigDecimal.ZERO) == 0) {
+ B1 = TempB;
+ } else {
+ if (temp.compareTo(Q) >= 0) {
+ B1 = B;
} else {
- 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();
- history.setCreateBySid(userSid);
- history.setDataTime(new Date());
- history.setUpdateState("1");
- history.setUpdateTime(new Date());
- history.setActualDate(p.getDueDate());
- history.setActualMoney(m2i.subtract(Q1));
- history.setBuckleKey("003");
- history.setBuckle("审核通过");
- history.setReturnWayKey("01");
- history.setReturnWay("直还");
- history.setPayState(0);
- history.setIsEnable(3);
- history.setPlanDetailSid(p.getSid());
- history.setScheduleSid(schedule.getSid());
- histories.add(history);
+ BigDecimal bigDecimal = temp.divide(Q, 2, BigDecimal.ROUND_HALF_UP);
+ B1 = B.multiply(bigDecimal);
}
- p.setOverdue(0);
- if (B1.compareTo(BigDecimal.ZERO) > 0) {
- FinUncollectedReceivablesDetailedJR jr = new FinUncollectedReceivablesDetailedJR();
- jr.setCreateBySid(userSid);
- jr.setBusSid(p.getSid());
- jr.setKxState("01");
- jr.setIsEnable(3);
- jr.setReveivableMoney(B1);
- jr.setCurrentReceivableMoney(B1);
- jr.setPayCostTitleKey("006");
- jr.setPayCostTitleValue("资金占用费");
- jrList.add(jr);
- LoanFundDay fundDay = new LoanFundDay();
- fundDay.setCreateBySid(userSid);
- fundDay.setIsEnable(3);
- fundDay.setCreateDate(returnYesterday());
- fundDay.setPaymentMoney(p.getPaymentMoney());
- fundDay.setFund(B1);
- fundDay.setBusSid(p.getSid());
- loanFundDays.add(fundDay);
- }
- Q1 = Q1.subtract(temp);
- } else if (Q1.compareTo(BigDecimal.ZERO) == 0) {
+ }
+ TempB = TempB.subtract(B1);
+ if (Q1.compareTo(m2i) < 0) {
+ //生成 i 期还款记录,月还金额 m1i - Q1
LoanRepaymentHistory history = new LoanRepaymentHistory();
history.setCreateBySid(userSid);
history.setDataTime(new Date());
history.setUpdateState("1");
history.setUpdateTime(new Date());
history.setActualDate(p.getDueDate());
- history.setActualMoney(p.getDueMoney());
+ history.setActualMoney(m2i.subtract(Q1));
history.setBuckleKey("003");
history.setBuckle("审核通过");
history.setReturnWayKey("01");
@@ -6596,14 +6549,54 @@ public class LoanRepaymentScheduleService extends MybatisBaseService 0) {
+ FinUncollectedReceivablesDetailedJR jr = new FinUncollectedReceivablesDetailedJR();
+ jr.setCreateBySid(userSid);
+ jr.setBusSid(p.getSid());
+ jr.setKxState("01");
+ jr.setIsEnable(3);
+ jr.setReveivableMoney(B1);
+ jr.setCurrentReceivableMoney(B1);
+ jr.setPayCostTitleKey("006");
+ jr.setPayCostTitleValue("资金占用费");
+ jrList.add(jr);
+ LoanFundDay fundDay = new LoanFundDay();
+ fundDay.setCreateBySid(userSid);
+ fundDay.setIsEnable(3);
+ fundDay.setCreateDate(returnYesterday());
+ fundDay.setPaymentMoney(p.getPaymentMoney());
+ fundDay.setFund(B1);
+ fundDay.setBusSid(p.getSid());
+ loanFundDays.add(fundDay);
+ }
+ Q1 = Q1.subtract(temp);
+ } else if (Q1.compareTo(BigDecimal.ZERO) == 0) {
+ LoanRepaymentHistory history = new LoanRepaymentHistory();
+ history.setCreateBySid(userSid);
+ history.setDataTime(new Date());
+ history.setUpdateState("1");
+ history.setUpdateTime(new Date());
+ history.setActualDate(p.getDueDate());
+ history.setActualMoney(p.getDueMoney());
+ history.setBuckleKey("003");
+ history.setBuckle("审核通过");
+ history.setReturnWayKey("01");
+ history.setReturnWay("直还");
+ history.setPayState(0);
+ history.setIsEnable(3);
+ history.setPlanDetailSid(p.getSid());
+ history.setScheduleSid(schedule.getSid());
+ histories.add(history);
+ }
+ if (pd) {
+ planDetails.add(p);
}
}
+ }
+
}
}
}
@@ -7031,11 +7024,11 @@ public class LoanRepaymentScheduleService extends MybatisBaseService loanRepaymentPlanDetails = loanRepaymentPlanDetailsService.selByMainSidAndPolicyOrOther(scheduleSid, "1");
appRepaymentPlanListDetailsWxVo.setOtherManagement(loanRepaymentPlanDetails.get(0).getBankName());
}
@@ -7064,7 +7057,7 @@ public class LoanRepaymentScheduleService extends MybatisBaseService appRepaymentHistoryRecords = loanRepaymentHistoryService.selSchSidAndVinNo(scheduleSid,vinNo);
+ List appRepaymentHistoryRecords = loanRepaymentHistoryService.selSchSidAndVinNo(scheduleSid, vinNo);
appRepaymentHistoryListDetailsWxVo.setRecords(appRepaymentHistoryRecords);
return appRepaymentHistoryListDetailsWxVo;
}