提前部分结清剩余本金取值修改

This commit is contained in:
zzk 2022-04-14 14:29:18 +08:00
parent f844fe28ce
commit 4aba17f3f2

View File

@ -217,6 +217,9 @@ public class EarlyContract {
//获取下月租金计划还款时间月份
c.add(Calendar.MONTH, 1);
b.add(Calendar.MONTH, 0);
String t1 = formatter.format(date3);
date3 = formatter.parse(t1);
String lastMonth1 = mon.format(c.getTime());
date4 = mon.parse(lastMonth1);
//获取约定终止日月份
@ -357,12 +360,14 @@ public class EarlyContract {
try{
Sqlca = Transaction.createTransaction(tx);
// 剩余本金- 本次结清车辆约定终止日次月后所有本金
String CORPUS_OVERAGE = Sqlca.getString("select sum(round(ifnull(lrp.CORPUS, 0) - ifnull(lri.CORPUS, 0),2)) as CORPUS from LC_RENT_PLAN LRP left join (select CONTRACT_ID,PLAN_LIST,SUM(ifnull(CORPUS, 0)) as CORPUS from LC_RENT_INCOME group by CONTRACT_ID,PLAN_LIST ) LRI on LRI.CONTRACT_ID = LRP.CONTRACT_ID and LRP.PLAN_LIST = LRI.PLAN_LIST where date_format(STR_TO_DATE(lrp.PLAN_DATE,'%Y/%m/%d'),'%Y/%m')> date_format(STR_TO_DATE('"+PAYDAY_ADJUST+"','%Y/%m/%d'),'%Y/%m') and lrp.CONTRACT_ID = '"+contractId+"'");
String CORPUS_OVERAGE = Sqlca.getString("select sum(CORPUS) from lc_rent_plan lrp where STR_TO_DATE(lrp.PLAN_DATE, '%Y/%m/%d')> STR_TO_DATE('"+PAYDAY_ADJUST+"', '%Y/%m/%d') and lrp.CONTRACT_ID = '"+contractId+"'");
if(CORPUS_OVERAGE == null) {
CORPUS_OVERAGE="0.00";
}
// 部分结清车辆未到期本金- 本次结清车辆约定终止日次月后所有本金
String PREMATURE_MONEY = Sqlca.getString("select sum(round(((ifnull(lrp.CORPUS, 0) - ifnull(lri.CORPUS, 0))*'"+REPURCHASE_RATIO+"'/100),2)) as CORPUS from LC_RENT_PLAN LRP left join (select CONTRACT_ID,PLAN_LIST,SUM(ifnull(CORPUS, 0)) as CORPUS from LC_RENT_INCOME group by CONTRACT_ID,PLAN_LIST ) LRI on LRI.CONTRACT_ID = LRP.CONTRACT_ID and LRP.PLAN_LIST = LRI.PLAN_LIST where date_format(STR_TO_DATE(lrp.PLAN_DATE,'%Y/%m/%d'),'%Y/%m')> date_format(STR_TO_DATE('"+PAYDAY_ADJUST+"','%Y/%m/%d'),'%Y/%m') and lrp.CONTRACT_ID = '"+contractId+"'");
BigDecimal cd = new BigDecimal(Double.parseDouble(CORPUS_OVERAGE)*Double.parseDouble(REPURCHASE_RATIO));
double t1 = cd.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
String PREMATURE_MONEY = Double.toString(t1);
if(PREMATURE_MONEY == null) {
PREMATURE_MONEY="0.00";
}