From edf4d4bc83476d5a004e68b072770671dc08cd57 Mon Sep 17 00:00:00 2001 From: luojian Date: Tue, 31 Jul 2018 17:28:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8F=90=E5=89=8D=E7=BB=93?= =?UTF-8?q?=E6=B8=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LCContractTerminateInfo.jsp | 30 ++++++++++++++++--- WebContent/WEB-INF/etc/jbo/jbo_calc.xml | 2 ++ .../tenwa/reckon/executor/RentCalHelper.java | 22 +++++++++++--- 3 files changed, 46 insertions(+), 8 deletions(-) diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LCContractTerminate/LCContractTerminateInfo.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LCContractTerminate/LCContractTerminateInfo.jsp index f3c9c2eed..178e28279 100644 --- a/WebContent/Tenwa/Lease/Flow/Comm/LCContractTerminate/LCContractTerminateInfo.jsp +++ b/WebContent/Tenwa/Lease/Flow/Comm/LCContractTerminate/LCContractTerminateInfo.jsp @@ -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(); diff --git a/WebContent/WEB-INF/etc/jbo/jbo_calc.xml b/WebContent/WEB-INF/etc/jbo/jbo_calc.xml index bb3ad0f50..d12fb22ca 100644 --- a/WebContent/WEB-INF/etc/jbo/jbo_calc.xml +++ b/WebContent/WEB-INF/etc/jbo/jbo_calc.xml @@ -310,6 +310,7 @@ + @@ -357,6 +358,7 @@ + diff --git a/calc/com/tenwa/reckon/executor/RentCalHelper.java b/calc/com/tenwa/reckon/executor/RentCalHelper.java index 185c10d14..159868883 100644 --- a/calc/com/tenwa/reckon/executor/RentCalHelper.java +++ b/calc/com/tenwa/reckon/executor/RentCalHelper.java @@ -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> results = conn.executeQuery(sql, this.contractId,this.getPaymentnumber(),this.contractId,this.getPaymentnumber()); - Map detailInfo = results.get(0); + Map 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();