增加提前结清资金费用项

This commit is contained in:
luojian 2018-08-04 16:04:33 +08:00
parent ff9b75e2f6
commit 004e899f9c
7 changed files with 191 additions and 29 deletions

View File

@ -15,8 +15,8 @@
String orgid = CurUser.getOrgID();
String sTabStrip[][] = {
{"true", "×â½ð¼Æ»®", "/Accounting/LoanSimulation/RentPlanList.jsp",params, "", "", "false"},
{"8009012002".equals(orgid)?"true":"false", "资金计划", "/Accounting/LoanSimulation/FundPlanList.jsp",params, "", "", "false"},
{"8009012002".equals(orgid)?"true":"false", "现金流", "/Accounting/LoanSimulation/CashFlowList.jsp",params, "", "", "false"},
{"8009012002,8009001".indexOf(orgid)>-1?"true":"false", "资金计划", "/Accounting/LoanSimulation/FundPlanList.jsp",params, "", "", "false"},
{"8009012002,8009001".indexOf(orgid)>-1?"true":"false", "现金流", "/Accounting/LoanSimulation/CashFlowList.jsp",params, "", "", "false"},
};
%>
<%@ include file="/Resources/CodeParts/Tab01.jsp"%>

View File

@ -76,16 +76,10 @@
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));
if(terminateInfo.fist_rent>0){
setItemValue(0,getRow(),"REPAYMENT_INTEREST","0");
}else{
setItemValue(0,getRow(),"REPAYMENT_INTEREST",terminateInfo.REPAYMENT_INTEREST);
}
setItemValue(0,getRow(),"FIST_CORPUS","0");
setItemValue(0,getRow(),"HANDLING_CHARGE",Number(remaincorpus*0.05).toFixed(2));
setItemValue(0,getRow(),"REPAYMENT_INTEREST","0");
setItemValue(0,getRow(),"SDNOMINAL_PRICE","0");
setItemValue(0,getRow(),"SDHANDLING_CHARGE","0");
@ -98,18 +92,32 @@
function getContractBondTotal(){
var dunrent = getItemValue(0,getRow(),"DUN_RENT");
var dunPenalty = getItemValue(0,getRow(),"DUN_PENALTY");
var corpusOverage = getItemValue(0,getRow(),"CORPUS_OVERAGE");
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 );
return Number(dunrent ? dunrent : 0 ) + Number(dunPenalty ? dunPenalty : 0 ) + Number(corpusOverage ? corpusOverage : 0 )
+ Number(fistRent ? fistRent : 0 ) + Number(handlingCharge ? handlingCharge : 0 ) + Number(otherin ? otherin : 0 )
- Number(otherout ? otherout : 0 ) + Number(nominalPrice ? nominalPrice : 0 ) ;
}
//¼ÆËãծȯ×ܼÆ
function updateContractBondTotal(){
var dunrent = getItemValue(0,getRow(),"DUN_RENT");
var agreedPenalty = getItemValue(0,getRow(),"AGREED_PENALTY");
var corpusOverage = getItemValue(0,getRow(),"CORPUS_OVERAGE");
var fistCorpus = getItemValue(0,getRow(),"FIST_CORPUS");
var sdhandlingCharge = getItemValue(0,getRow(),"SDHANDLING_CHARGE");
var otherin = getItemValue(0,getRow(),"OTHER_IN");
var otherout = getItemValue(0,getRow(),"OTHER_OUT");
var sdnominalPrice=getItemValue(0,getRow(),"SDNOMINAL_PRICE");
return Number(dunrent ? dunrent : 0 ) + Number(agreedPenalty ? agreedPenalty : 0 ) + Number(corpusOverage ? corpusOverage : 0 )
+ Number(fistCorpus ? fistCorpus : 0 ) + Number(sdhandlingCharge ? sdhandlingCharge : 0 ) + Number(otherin ? otherin : 0 )
- Number(otherout ? otherout : 0 ) + Number(sdnominalPrice ? sdnominalPrice : 0 ) ;
}
//计算债券总计
/* function getContractBondTotal(){
var dunrent = getItemValue(0,getRow(),"DUN_RENT");
@ -143,7 +151,8 @@
//检查是否进行过变更
var result = AsControl.RunJavaMethod("com.tenwa.reckon.executor.CreateTransactionExecutor","checkIsRentChange","flowunid=<%=flowunid%>,plannumber=<%=paymentnumber%>");
if(result == 'true'){
as_save("myiframe0","run()");
setItemValue(0,getRow(),"CONTRACT_TOTAL",updateContractBondTotal());
as_save("myiframe0","run()");
}else{
alert('请先撤销变更,再进行变更操作!!!');
}
@ -159,19 +168,17 @@
setItemValue(0,0,"flowunid","<%=flowunid%>");
setItemValue(0,0,"PAYDAY_DATE","<%=StringFunction.getToday()%>");
//设置商定罚息带出逾期罚息
setItemValue(0,0,"AGREED_PENALTY",getItemValue(0,0,'DUN_PENALTY'));
//setItemValue(0,0,"AGREED_PENALTY",getItemValue(0,0,'DUN_PENALTY'));
//判断其他应收和其他应退是否为空
var otherIn = getItemValue(0,getRow(),"OTHER_IN");
var otherOut = getItemValue(0,getRow(),"OTHER_OUT");
if(!otherIn && !otherOut){
//其他应收和其他应退
var result = AsControl.RunJavaMethod("com.tenwa.reckon.executor.RentCalHelper","getTerminateOtherInfo","contractId=<%=contractId%>,paymentnumber=<%=paymentnumber%>");
var result = AsControl.RunJavaMethod("com.tenwa.reckon.executor.RentCalHelper","getTerminateOtherInfoFinish","contractId=<%=contractId%>,paymentnumber=<%=paymentnumber%>");
for(var p in result){
setItemValue(0,getRow(),p,result[p]);
}
}
setItemValue(0,getRow(),"OTHER_IN","0");
setItemValue(0,getRow(),"OTHER_OUT","0");
});
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>

View File

@ -302,7 +302,7 @@ public class CreateTransactionExecutor implements Transaction {
//AdjustBean ab = ObjectConvertUtils.converBizObjectToBean(AdjustBean.class, bo);
RentTerminateExe exe = new RentTerminateExe(tx);
FundRentPlanBean rentPlan = exe.create(bean.getCb(), bo, bean);
this.createFundPlan(rentPlan, bean,tx);
this.createFundPlanTerminate(rentPlan, bean,tx,bo);
this.createCashFlow(bean,tx);
jsonObject.appendElement("result", "true");
this.callBack(jsonObject, bean.getCb(), bean,rentPlan,false,tx);
@ -408,7 +408,13 @@ public class CreateTransactionExecutor implements Transaction {
FundFundPlanExecutor fundFundExecutor = new FundFundPlanExecutor();
fundFundExecutor.run(bean.getCb(), bean, planBean,tx);
}
@Override
public void createFundPlanTerminate(FundRentPlanBean planBean, TabCalBean bean,JBOTransaction tx,BizObject bo)
throws Exception {
FundFundPlanExecutor fundFundExecutor = new FundFundPlanExecutor();
fundFundExecutor.runTerminate(bean.getCb(), bean, planBean,tx,bo);
}
@Override
public String createCashFlow(TabCalBean bean,JBOTransaction tx) throws Exception {
CashFlowExecutor executor = new CashFlowExecutor(tx);

View File

@ -7,9 +7,10 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import jbo.app.tenwa.calc.LC_FUND_PLAN;
import jbo.sys.CODE_LIBRARY;
import jbo.app.tenwa.calc.LC_FUND_PLAN_TEMP;
import com.amarsoft.app.util.ProductParamUtil;
import com.amarsoft.app.util.StringUtil;
@ -41,6 +42,108 @@ public class FundFundPlanExecutor {
this.delete(tcb,tx);
this.add(fundPlanBeans, tcb,tx);
}
public void runTerminate(ConditionBean cb , TabCalBean tcb,FundRentPlanBean rentPlan,JBOTransaction tx,BizObject bo) throws Exception{
cb.setDocId(tcb.getDocId());
List<FundPlanBean> fundPlanBeans=new ArrayList<FundPlanBean>();
if(Double.parseDouble(cb.getCautionDeductionMoney()) > 0 ){
fundPlanBeans = splitFundFundPlan(rentPlan, cb, "", "feetype17","feetype16");
}else{
cb.setDeductionLastPlanDate(cb.getLastPlanDate());//不生成保证金抵扣及退还计划
}
fundPlanBeans = this.create(tcb,fundPlanBeans,tx);
fundPlanBeans = this.createTerminate(tcb,fundPlanBeans,tx,bo);
this.delete(tcb,tx);
this.add(fundPlanBeans, tcb,tx);
}
private List<FundPlanBean> createTerminate(TabCalBean tcb,List<FundPlanBean> fundPlanBeans,JBOTransaction tx,BizObject bo) throws Exception{
FundPlanBean ffcp = null;
String custid="";
if("quoted_price".equals(tcb.getCalType())){
custid=tcb.getDocId();
}else if(tcb.getUserId()==null||tcb.getUserId().equals("")){
}else{
String sql2="select customer_id from "+tcb.getUserId()+" where flowunid='"+tcb.getDocId()+"'";
List<Map<String,String>> list=DataOperatorUtil.getDataBySql(tx, sql2, null);
if(list.size()>0){
custid=list.get(0).get("customer_id");
}
}
String paydayAdjust=bo.getAttribute("PAYDAY_ADJUST").toString();//终止日
for (FundPlanBean fundPlanBean : fundPlanBeans) {
if("feetype16".equals(fundPlanBean.getFeeType())&&"pay_type_out".equals(fundPlanBean.getPayType())){
fundPlanBean.setPlanDate(paydayAdjust);
break;
}
}
BizObjectManager bm=JBOFactory.getBizObjectManager(tcb.getFundFundPlan_tb(), tx);
String sdnominalPrice=bo.getAttribute("SDNOMINAL_PRICE").toString();
if(Float.parseFloat(sdnominalPrice)>0){
ffcp=new FundPlanBean();
BizObject bo4 = bm.createQuery("select * from O where FEE_TYPE='feetype4' and PAY_TYPE='pay_type_in' and flowunid=:flowunid ").setParameter("flowunid", tcb.getDocId()).getSingleResult(true);
if(bo4!=null){
ffcp.setId(bo4.getAttribute("ID").toString());
ffcp.setFeeType(bo4.getAttribute(LC_FUND_PLAN_TEMP.FEE_TYPE).toString());//商定留购价
ffcp.setPlanList(bo4.getAttribute(LC_FUND_PLAN_TEMP.PLAN_LIST).toString());
ffcp.setSettleMethod(bo4.getAttribute(LC_FUND_PLAN_TEMP.SETTLE_METHOD).toString());
ffcp.setPayType(bo4.getAttribute(LC_FUND_PLAN_TEMP.PAY_TYPE).toString());
ffcp.setPlanDate(paydayAdjust);
ffcp.setPlanMoney(sdnominalPrice);
ffcp.setPayCust(custid);
fundPlanBeans.add(ffcp);
}else{
ffcp.setId(UUID.randomUUID().toString().replaceAll("-", ""));
ffcp.setFeeType("feetype4");//商定留购价
ffcp.setPlanList("1");
ffcp.setSettleMethod("payfund6");
ffcp.setPayType("pay_type_in");
ffcp.setPlanDate(paydayAdjust);
ffcp.setPlanMoney(sdnominalPrice);
ffcp.setPayCust(custid);
fundPlanBeans.add(ffcp);
}
}
String sdhandlingCharge=bo.getAttribute("SDHANDLING_CHARGE").toString();
if(Float.parseFloat(sdhandlingCharge)>0){
ffcp=new FundPlanBean();
ffcp.setId(UUID.randomUUID().toString().replaceAll("-", ""));
ffcp.setFeeType("feetype30");//商定违约金
ffcp.setPlanList("1");
ffcp.setSettleMethod("payfund6");
ffcp.setPayType("pay_type_in");
ffcp.setPlanDate(paydayAdjust);
ffcp.setPlanMoney(sdhandlingCharge);
ffcp.setPayCust(custid);
fundPlanBeans.add(ffcp);
}
String fistCorpus=bo.getAttribute("FIST_CORPUS").toString();
if(Float.parseFloat(fistCorpus)>0){
ffcp=new FundPlanBean();
ffcp.setId(UUID.randomUUID().toString().replaceAll("-", ""));
ffcp.setFeeType("feetype31");//商定一年内剩余利息
ffcp.setPlanList("1");
ffcp.setSettleMethod("payfund6");
ffcp.setPayType("pay_type_in");
ffcp.setPlanDate(paydayAdjust);
ffcp.setPlanMoney(fistCorpus);
ffcp.setPayCust(custid);
fundPlanBeans.add(ffcp);
}
String otherIn=bo.getAttribute("OTHER_IN").toString();
if(Float.parseFloat(otherIn)>0){
ffcp=new FundPlanBean();
ffcp.setId(UUID.randomUUID().toString().replaceAll("-", ""));
ffcp.setFeeType("feetype8");//其他应收
ffcp.setPlanList("1");
ffcp.setSettleMethod("payfund6");
ffcp.setPayType("pay_type_in");
ffcp.setPlanDate(paydayAdjust);
ffcp.setPlanMoney(otherIn);
ffcp.setPayCust(custid);
fundPlanBeans.add(ffcp);
}
return fundPlanBeans;
}
//´´½¨×Ê½ð¼Æ»®
private List<FundPlanBean> create(TabCalBean tcb,List<FundPlanBean> fundPlanBeans,JBOTransaction tx) throws Exception{
//»ñÈ¡²úÆ·×âÁÞÎïÀàÐÍÅäÖÃ
@ -136,6 +239,7 @@ public class FundFundPlanExecutor {
//ɾ³ý×Ê½ð¼Æ»®
private void delete(TabCalBean tcb,JBOTransaction tx) throws Exception{
String sql = " delete from O where flowunid='" + tcb.getDocId() + "' and "+tcb.getPlanCName()+"='"+tcb.getPlanCValue()+"'";
System.out.println(sql);
BizObjectManager bm=JBOFactory.getBizObjectManager(tcb.getFundFundPlan_tb(), tx);
bm.createQuery(sql).executeUpdate();
}

View File

@ -145,7 +145,7 @@ public class RentCalHelper {
+ " 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,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 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.interest 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 ("
@ -224,7 +224,7 @@ public class RentCalHelper {
+ " sum(case ffp.pay_type when 'pay_type_out' then ffp.plan_money else 0 end)sumplanout, "
+ " min(ffp.contract_id) contractid,min(ffp.payment_number) paymentnumber "
+ " from LC_FUND_PLAN ffp "
+ " where ffp.contract_id = ? and ffp.payment_number=?"
+ " where ffp.contract_id = ? and ffp.payment_number=? "
+ " )t2 on t1.contractid = t2.contractid and t1.paymentnumber=t2.paymentnumber left join lc_calc_condition lc on lc.CONTRACT_ID=t2.contractid";
if("ORACLE".equals(InitDBType.DBTYPE)){
fundSql=fundSql.replaceAll("ifnull", "nvl");
@ -255,6 +255,49 @@ public class RentCalHelper {
}
return JSONEncoder.encode(jsonObject);
}
public String getTerminateOtherInfoFinish() throws Exception {
JSONObject jsonObject = JSONObject.createObject();
String fundSql = "select t2.sumplanin,t2.sumplanout,max(lc.NOMINAL_PRICE) nominalprice from ( "
+ " select sum(case ffc.pay_type when 'pay_type_in' then ffc.fact_money else 0 end )sumchargein, "
+ " sum(case ffc.pay_type when 'pay_type_out' then ffc.fact_money else 0 end )sumchargeout, "
+ " min(ffc.contract_id) contractid,min(ffc.payment_number) paymentnumber "
+ " from LC_FUND_INCOME ffc where ffc.contract_id = ? and ffc.payment_number=? "
+ " )t1 right join "
+ " (select sum(case ffp.pay_type when 'pay_type_in' then ffp.plan_money else 0 end )sumplanin, "
+ " sum(case ffp.pay_type when 'pay_type_out' then ffp.plan_money else 0 end)sumplanout, "
+ " min(ffp.contract_id) contractid,min(ffp.payment_number) paymentnumber "
+ " from LC_FUND_PLAN ffp "
+ " where ffp.contract_id = ? and ffp.payment_number=? and ffp.FEE_TYPE='feetype16' "
+ " )t2 on t1.contractid = t2.contractid and t1.paymentnumber=t2.paymentnumber left join lc_calc_condition lc on lc.CONTRACT_ID=t2.contractid";
if("ORACLE".equals(InitDBType.DBTYPE)){
fundSql=fundSql.replaceAll("ifnull", "nvl");
}
JBOTransaction tx=null;
try {
tx=JBOFactory.createJBOTransaction();
Conn conn = new Conn(tx);
List<Map<String, String>> list = conn.executeQuery(fundSql, this.contractId ,this.getPaymentnumber(), this.contractId,this.getPaymentnumber());
if(null != list && list.size() > 0 ){
Map<String, String> fundMap = list.get(0);
jsonObject.appendElement("OTHER_IN",fundMap.get("sumplanin"));
jsonObject.appendElement("OTHER_OUT",fundMap.get("sumplanout"));
jsonObject.appendElement("NOMINAL_PRICE",fundMap.get("nominalprice"));
}else{
jsonObject.appendElement("OTHER_IN","0");
jsonObject.appendElement("OTHER_OUT","0");
jsonObject.appendElement("NOMINAL_PRICE","0");
}
} catch (JBOException e) {
tx.rollback();
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
if(tx!=null){
tx.commit();
}
}
return JSONEncoder.encode(jsonObject);
}
public String getContractId() {

View File

@ -3,6 +3,7 @@ package com.tenwa.reckon.executor;
import java.io.InputStream;
import java.util.Map;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.JBOTransaction;
import com.amarsoft.are.util.json.JSONObject;
import com.tenwa.reckon.bean.AdjustBean;
@ -60,4 +61,5 @@ public interface Transaction {
public String runTerminate() throws Exception;
public int importRentPlan(String fileName,InputStream sourceFile,Map<String,String>sourceMap) throws Exception;
public void createFundPlanTerminate(FundRentPlanBean rentPlan, TabCalBean bean,JBOTransaction tx,BizObject bo) throws Exception;
}

View File

@ -78,12 +78,12 @@ public class RentTerminateExe {
rentNew.setAttributeValue("plan_list", rent_list);
rentNew.setAttributeValue("plan_date",payMoneyday);
rentNew.setAttributeValue("plan_status","δ»ØÁý");
rentNew.setAttributeValue("rent", contractTotal);
rentNew.setAttributeValue("rent", endCorpus);
rentNew.setAttributeValue("PENALTY",bo.getAttribute("AGREED_PENALTY").getString());
rentNew.setAttributeValue("corpus_business", endCorpus);
rentNew.setAttributeValue("year_rate", yearRate);
rentNew.setAttributeValue("interest_business", endInterest);
rentNew.setAttributeValue("interest", new BigDecimal(contractTotal).subtract(endCorpus).toString());
rentNew.setAttributeValue("interest_business", "0");
rentNew.setAttributeValue("interest", "0");
rentNew.setAttributeValue("corpus", endCorpus);
rentNew.setAttributeValue("ALL_REMAIN_CORPUS", corpusMoney);
bm.saveObject(rentNew);