|
|
@ -5257,6 +5257,7 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
if (sleep.equals("否")) { |
|
|
|
LoanRepaymentSchedule scheduleDetails = new LoanRepaymentSchedule(); |
|
|
|
scheduleDetails.setCreateBySid(userSid); |
|
|
|
scheduleDetails.setOrgSidPath(orgPath); |
|
|
|
String scheduleSid = scheduleDetails.getSid(); |
|
|
|
scheduleDetails.setIsOtherPolicy(isOther); |
|
|
|
scheduleDetails.setSameBank(sameBank); |
|
|
@ -5577,7 +5578,6 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
System.out.println("============================"); |
|
|
|
System.out.println(schedules); |
|
|
|
System.out.println("============================"); |
|
|
|
|
|
|
|
generateHistoryData(schedules, userSid); |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
@ -5650,20 +5650,13 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
importSleepData.setPolicyOrOther("1"); |
|
|
|
} |
|
|
|
String salesOrderSid = mainSchedule.getSalesOrderSid(); |
|
|
|
BusSalesOrder order = busSalesOrderFeign.fetchBySid(salesOrderSid).getData(); |
|
|
|
if (null != order) { |
|
|
|
if (StringUtils.isNotBlank(order.getOrgSid())) { |
|
|
|
importSleepData.setDeptSid(order.getOrgSid()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(order.getOrgName())) { |
|
|
|
importSleepData.setDept(order.getOrgName()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(order.getUseOrgSid())) { |
|
|
|
importSleepData.setUseOrgSid(order.getUseOrgSid()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(order.getOrgSidPath())) { |
|
|
|
importSleepData.setOrgSidPath(order.getOrgSidPath()); |
|
|
|
} |
|
|
|
String orgSidPath = mainSchedule.getOrgSidPath(); |
|
|
|
SysOrganizationVo deptData = sysOrganizationFeign.selectByOrgSidPath(orgSidPath).getData(); |
|
|
|
if (null != deptData) { |
|
|
|
importSleepData.setDeptSid(deptData.getSid()); |
|
|
|
importSleepData.setDept(deptData.getName()); |
|
|
|
importSleepData.setUseOrgSid(deptData.getPsid()); |
|
|
|
importSleepData.setOrgSidPath(orgSidPath); |
|
|
|
} |
|
|
|
BusSalesOrderVehicle orderVehicle = busSalesOrderVehicleFeign.selByOrderSidAndVinNo(salesOrderSid, vinNo).getData(); |
|
|
|
if (null != orderVehicle) { |
|
|
@ -6011,114 +6004,74 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
jrList.add(jr); |
|
|
|
} |
|
|
|
} |
|
|
|
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; |
|
|
|
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<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 = 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<LoanRepayme |
|
|
|
history.setScheduleSid(schedule.getSid()); |
|
|
|
histories.add(history); |
|
|
|
} |
|
|
|
if (pd) { |
|
|
|
planDetails.add(p); |
|
|
|
} |
|
|
|
|
|
|
|
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); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
M2 = getDiffPeriod(new Date(), schedule.getOtherRepayDate()); |
|
|
@ -6360,114 +6353,74 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
jrList.add(jr); |
|
|
|
} |
|
|
|
} |
|
|
|
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; |
|
|
|
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<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 = 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<LoanRepayme |
|
|
|
history.setScheduleSid(schedule.getSid()); |
|
|
|
histories.add(history); |
|
|
|
} |
|
|
|
if (pd) { |
|
|
|
planDetails.add(p); |
|
|
|
} |
|
|
|
|
|
|
|
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); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -7031,11 +7024,11 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
appRepaymentPlanListDetailsWxVo.setSalesName(loanRepaymentSchedule.getStaffName()); |
|
|
|
appRepaymentPlanListDetailsWxVo.setManagement(loanRepaymentSchedule.getBankName()); |
|
|
|
appRepaymentPlanListDetailsWxVo.setZcpDate(loanRepaymentSchedule.getMainPeriod() + "/" + DateUtil.formatDate(loanRepaymentSchedule.getMainRepayDate()) + "(首还)"); |
|
|
|
if ("1".equals(loanRepaymentSchedule.getIsOtherPolicy())){//有其他融
|
|
|
|
if ("1".equals(loanRepaymentSchedule.getIsOtherPolicy())) {//有其他融
|
|
|
|
appRepaymentPlanListDetailsWxVo.setPtrDate(loanRepaymentSchedule.getOtherPeriod() + "/" + DateUtil.formatDate(loanRepaymentSchedule.getOtherRepayDate()) + "(首还)"); |
|
|
|
if ("1".equals(loanRepaymentSchedule.getSameBank())){//其他融资方与主产品相同
|
|
|
|
if ("1".equals(loanRepaymentSchedule.getSameBank())) {//其他融资方与主产品相同
|
|
|
|
appRepaymentPlanListDetailsWxVo.setOtherManagement(appRepaymentPlanListDetailsWxVo.getManagement()); |
|
|
|
}else {//其他融资方与主产品不相同
|
|
|
|
} else {//其他融资方与主产品不相同
|
|
|
|
List<LoanRepaymentPlanDetails> loanRepaymentPlanDetails = loanRepaymentPlanDetailsService.selByMainSidAndPolicyOrOther(scheduleSid, "1"); |
|
|
|
appRepaymentPlanListDetailsWxVo.setOtherManagement(loanRepaymentPlanDetails.get(0).getBankName()); |
|
|
|
} |
|
|
@ -7064,7 +7057,7 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
appRepaymentPlanThead3.setEmptyString("-"); |
|
|
|
appRepaymentPlanThead3.setAlign("center"); |
|
|
|
appRepaymentPlanTheads.add(appRepaymentPlanThead3); |
|
|
|
if ("1".equals(loanRepaymentSchedule.getIsOtherPolicy())){ |
|
|
|
if ("1".equals(loanRepaymentSchedule.getIsOtherPolicy())) { |
|
|
|
AppRepaymentPlanThead appRepaymentPlanThead4 = new AppRepaymentPlanThead(); |
|
|
|
appRepaymentPlanThead4.setName("otherMonthlyPaymentStr"); |
|
|
|
String[] qtrDate = DateUtil.formatDate(loanRepaymentSchedule.getOtherRepayDate()).split("-"); |
|
|
@ -7121,7 +7114,7 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
appRepaymentHistoryThead5.setAlign("center"); |
|
|
|
appRepaymentHistoryTheads.add(appRepaymentHistoryThead5); |
|
|
|
appRepaymentHistoryListDetailsWxVo.setThead(appRepaymentHistoryTheads); |
|
|
|
List<AppRepaymentHistoryRecord> appRepaymentHistoryRecords = loanRepaymentHistoryService.selSchSidAndVinNo(scheduleSid,vinNo); |
|
|
|
List<AppRepaymentHistoryRecord> appRepaymentHistoryRecords = loanRepaymentHistoryService.selSchSidAndVinNo(scheduleSid, vinNo); |
|
|
|
appRepaymentHistoryListDetailsWxVo.setRecords(appRepaymentHistoryRecords); |
|
|
|
return appRepaymentHistoryListDetailsWxVo; |
|
|
|
} |
|
|
|