修改提前结清

This commit is contained in:
luojian 2018-07-31 17:28:04 +08:00
parent 3dc8c79f8f
commit edf4d4bc83
3 changed files with 46 additions and 8 deletions

View File

@ -72,20 +72,42 @@
setItemValue(0,getRow(),"INTEREST_HANDLING_CHARGE",remaininterest);
//商定利息默认等于未到期利息
setItemValue(0,getRow(),"AGREED_INTEREST",remaininterest);
//¼ÆËãºÏͬծȯ×ܼÆ
setItemValue(0,getRow(),"CONTRACT_TOTAL",getContractBondTotal());
//回购比例 默认100
setItemValue(0,getRow(),"REPURCHASE_RATIO","100");
//回购本金
setItemValue(0,getRow(),"REPURCHASE_MONEY",remaincorpus);
setItemValue(0,getRow(),"FIST_RENT",terminateInfo.fist_rent);
setItemValue(0,getRow(),"FIST_CORPUS",terminateInfo.fist_corpus);
setItemValue(0,getRow(),"HANDLING_CHARGE",Number(terminateInfo.fist_corpus*0.05).toFixed(2));
setItemValue(0,getRow(),"REPAYMENT_INTEREST",terminateInfo.REPAYMENT_INTEREST);
setItemValue(0,getRow(),"SDNOMINAL_PRICE","0");
setItemValue(0,getRow(),"SDHANDLING_CHARGE","0");
//¼ÆËãºÏͬծȯ×ܼÆ
setItemValue(0,getRow(),"CONTRACT_TOTAL",getContractBondTotal());
}
}
//¼ÆËãծȯ×ܼÆ
function getContractBondTotal(){
var dunrent = getItemValue(0,getRow(),"DUN_RENT");
var dunPenalty = getItemValue(0,getRow(),"DUN_PENALTY");
var fistRent = getItemValue(0,getRow(),"FIST_RENT");
var fistCorpus = getItemValue(0,getRow(),"FIST_CORPUS");
var handlingCharge = getItemValue(0,getRow(),"HANDLING_CHARGE");
var otherin = getItemValue(0,getRow(),"OTHER_IN");
var otherout = getItemValue(0,getRow(),"OTHER_OUT");
var nominalPrice=getItemValue(0,getRow(),"NOMINAL_PRICE");
var repaymentInterest=getItemValue(0,getRow(),"REPAYMENT_INTEREST");
return Number(dunrent ? dunrent : 0 ) + Number(dunPenalty ? dunPenalty : 0 ) + Number(fistRent ? fistRent : 0 )
+ Number(fistCorpus ? fistCorpus : 0 ) + Number(handlingCharge ? handlingCharge : 0 ) + Number(otherin ? otherin : 0 )
- Number(otherout ? otherout : 0 ) + Number(nominalPrice ? nominalPrice : 0 ) + Number(repaymentInterest ? repaymentInterest : 0 );
}
//计算债券总计
function getContractBondTotal(){
/* function getContractBondTotal(){
var dunrent = getItemValue(0,getRow(),"DUN_RENT");
var corpusoverage = getItemValue(0,getRow(),"CORPUS_OVERAGE");
var corpusinterest = 0;
@ -97,7 +119,7 @@
return Number(otherin ? otherin : 0 ) - Number(otherout ? otherout : 0 ) + Number(dunrent ? dunrent : 0 )
+ Number(corpusoverage ? corpusoverage : 0 ) + Number(corpusinterest ? corpusinterest : 0 ) + Number(agreedinterest ? agreedinterest : 0 )
+ Number(agreepenalty ? agreepenalty : 0 ) + Number(dunpenalty ? dunpenalty : 0 ) ;
}
} */
function cancelChange(){
openDWDialog();

View File

@ -310,6 +310,7 @@
<attribute name="SDNOMINAL_PRICE" label="商定留购价" type="DOUBLE" length="22" scale="2"/>
<attribute name="SDHANDLING_CHARGE" label="商定手续费" type="DOUBLE" length="22" scale="2"/>
<attribute name="FIST_RENT" label="一年内未还租金" type="DOUBLE" length="22" scale="2"/>
<attribute name="FIST_CORPUS" label="一年内未剩余本金" type="DOUBLE" length="22" scale="2"/>
<attribute name="REPAYMENT_INTEREST" label="还款日差利息" type="DOUBLE" length="22" scale="2"/>
</attributes>
@ -357,6 +358,7 @@
<attribute name="SDNOMINAL_PRICE" label="商定留购价" type="DOUBLE" length="22" scale="2"/>
<attribute name="SDHANDLING_CHARGE" label="商定手续费" type="DOUBLE" length="22" scale="2"/>
<attribute name="FIST_RENT" label="一年内未还租金" type="DOUBLE" length="22" scale="2"/>
<attribute name="FIST_CORPUS" label="一年内未剩余本金" type="DOUBLE" length="22" scale="2"/>
<attribute name="REPAYMENT_INTEREST" label="还款日差利息" type="DOUBLE" length="22" scale="2"/>
</attributes>
<manager>

View File

@ -1,5 +1,6 @@
package com.tenwa.reckon.executor;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -7,6 +8,7 @@ import java.util.Map;
import jbo.app.tenwa.calc.LC_CALC_CONDITION;
import jbo.app.tenwa.calc.LC_RENT_INCOME;
import jbo.app.tenwa.calc.LC_RENT_PLAN;
import jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT;
import com.amarsoft.app.awe.config.InitDBType;
import com.amarsoft.are.jbo.BizObject;
@ -19,6 +21,7 @@ import com.amarsoft.are.util.json.JSONEncoder;
import com.amarsoft.are.util.json.JSONObject;
import com.tenwa.reckon.util.Conn;
import com.tenwa.reckon.util.DateUtil;
import com.tenwa.reckon.util.DateUtils;
/**
* ºÏͬÖÐ;ÖÐÖ¹
* @author tenwapc
@ -136,13 +139,16 @@ public class RentCalHelper {
JBOTransaction tx=null;
try{
tx=JBOFactory.createJBOTransaction();
BizObjectManager bm = JBOFactory.getBizObjectManager(LC_CALC_CONDITION.CLASS_NAME);
Conn conn = new Conn(tx);
String sql = "select sum(case when DATE_FORMAT(t.plandate,'%Y/%m/%d') > DATE_FORMAT('"+this.paydayAdjust+"','%Y/%m/%d') then t.remaincorpus else 0 end ) remaincorpus,"
+ " sum(case when DATE_FORMAT(t.plandate,'%Y/%m/%d') > DATE_FORMAT('"+this.paydayAdjust+"','%Y/%m/%d') then t.remaininterest else 0 end ) remaininterest, "
+" sum(case when DATE_FORMAT(t.plandate,'%Y/%m/%d') > DATE_FORMAT('"+this.paydayAdjust+"','%Y/%m/%d') then t.corpus else 0 end ) remainfincorpus,"
+" sum(case when DATE_FORMAT( t.plandate,'%Y/%m/%d') > DATE_FORMAT('"+this.paydayAdjust+"','%Y/%m/%d') then t.interest else 0 end ) remainfininterest,"
+" sum(case when DATE_FORMAT( t.plandate,'%Y/%m/%d') <= DATE_FORMAT('"+this.paydayAdjust+"','%Y/%m/%d') then t.overduerent else 0 end ) overduerent,min(t.rent*(12-t.cou)) fist_rent "
+ " from ("
+" sum(case when DATE_FORMAT( t.plandate,'%Y/%m/%d') <= DATE_FORMAT('"+this.paydayAdjust+"','%Y/%m/%d') then t.overduerent else 0 end ) overduerent,sum(case when t.cou< t.planlist and t.planlist-t.cou<=12-t.cou then t.rent else 0 end) fist_rent,"
+ " sum(case when t.cou< t.planlist and t.planlist-t.cou>12-t.cou then t.corpus else 0 end) fist_corpus,"
+ " max( case when DATE_FORMAT(t.plandate, '%Y/%m/%d') < DATE_FORMAT('"+this.paydayAdjust+"','%Y/%m/%d') then t.plandate else '0' end) plandate"
+ " from ("
+ " select "
+ " t1.corpus-ifnull(t2.sumincomecorpus,0) remaincorpus,"
+ " t1.interestbusiness - ifnull(t2.sumincomeinterest,0) remaininterest,"
@ -179,11 +185,19 @@ public class RentCalHelper {
sql=sql.replaceAll("ifnull", "nvl");
}
List<Map<String, String>> results = conn.executeQuery(sql, this.contractId,this.getPaymentnumber(),this.contractId,this.getPaymentnumber());
Map<String, String> detailInfo = results.get(0);
Map<String, String> detailInfo = results.get(0);
for(String key : detailInfo.keySet()){
jsonObject.appendElement(key, detailInfo.get(key));
}
System.out.println(jsonObject.toString());
if(detailInfo.size()>0){
String planDate=detailInfo.get("plandate");
BigDecimal fistCorpus= new BigDecimal(detailInfo.get("fist_corpus"));
long numberDay=DateUtils.DateDays(this.paydayAdjust, planDate);
BizObject bo=bm.createQuery(" select * from O where contract_id=:contract_id").setParameter("contract_id", this.contractId).getSingleResult(false);
BigDecimal yearRate= new BigDecimal(bo!=null?bo.getAttribute(LC_CALC_CONDITION.YEAR_RATE).toString():"");
BigDecimal repaymentInterest=fistCorpus.multiply(yearRate).divide(new BigDecimal(360), 20, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(numberDay));
jsonObject.appendElement("REPAYMENT_INTEREST", repaymentInterest.setScale(2, BigDecimal.ROUND_HALF_UP).toString());
}
return JSONEncoder.encode(jsonObject);
}catch(Exception e){
tx.rollback();