From b625c16d47bb89142fb6dda05dd91a53daf570d5 Mon Sep 17 00:00:00 2001 From: zhulianghua Date: Fri, 14 Sep 2018 10:04:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=89=E9=B9=8F=E4=BC=A0?= =?UTF-8?q?=E7=BB=9F=E4=B8=9A=E5=8A=A1=E6=B5=8B=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LoanSimulation/LoanBasicInfoBusiness.jsp | 92 ++++++++++--------- .../condition_plan_business.jsp | 23 +++++ calc/com/tenwa/reckon/bean/TabCalBean.java | 9 ++ .../executor/CreateTransactionExecutor.java | 9 ++ .../reckon/executor/FundFundPlanExecutor.java | 6 ++ .../reckon/product/ProductCondition.java | 80 ++++++++++++++++ calc/com/tenwa/reckon/util/TbBeanTools.java | 1 + 7 files changed, 177 insertions(+), 43 deletions(-) create mode 100644 WebContent/Accounting/LoanSimulation/condition_plan_business.jsp diff --git a/WebContent/Accounting/LoanSimulation/LoanBasicInfoBusiness.jsp b/WebContent/Accounting/LoanSimulation/LoanBasicInfoBusiness.jsp index 92f6ecd47..342feb675 100644 --- a/WebContent/Accounting/LoanSimulation/LoanBasicInfoBusiness.jsp +++ b/WebContent/Accounting/LoanSimulation/LoanBasicInfoBusiness.jsp @@ -89,6 +89,7 @@ doTemp.setHtmlEvent("START_DATE", "onchange", "changeStartDate");//起租日 doTemp.setHtmlEvent("FIRST_PLAN_DATE", "onchange", "changeFistPlanDate");//第一期计划日期 doTemp.setHtmlEvent("CORPUS_RATIO", "onchange", "changeCorpusRatio");//期限内本金比例 + doTemp.setHtmlEvent("RATE_TYPE", "onchange", "changeRateTypeNew");//利率类型 /*设置字段事件*/ /*设置模板属性*/ @@ -96,21 +97,8 @@ //费用规则 ProductCondition pc=new ProductCondition(); pc.getProductFundRules(doTemp, productId); - String calcRules=pc.getProductRules(doTemp, productId,vali); + String calcRules=pc.getProductRulesBusiness(doTemp, productId,vali); - //非车辆产品,融资额可编辑 - String productType = Sqlca.getString(new SqlObject("select attribute2 from business_type where typeno='"+productId+"'")); - if("car_product".equals(productType)){ - doTemp.setReadOnly("CLEAN_LEASE_MONEY", false); - }else if("business_product".equals(productType)){ - /* doTemp.setVisible("CORPUS_RATIO", true); - doTemp.setVisible("CORPUS", true); - doTemp.setRequired("CORPUS_RATIO", true); */ - doTemp.setHtmlEvent("EQUIP_AMT", "onchange", "calcRaisedForTraditional"); - doTemp.setHtmlEvent("INSURANCE_PREMIUM", "onchange", "calcRaisedForTraditional"); - doTemp.setHtmlEvent("OTHER_INCOME", "onchange", "calcRaisedForTraditional"); - doTemp.setHtmlEvent("FIRST_PAYMENT", "onchange", "calcRaisedForTraditional"); - } if("quoted_price".equals(calType)){//客户报价 流程号存的是客户主键 doTemp.setDefaultValue("cust_id", flowunid); } @@ -150,7 +138,7 @@ CurPage.getCurComp().setAttribute("RightType", RightType); String compClientID = request.getParameter("CompClientID"); - dwTemp.replaceColumn("condition_plan", "", CurPage.getObjectWindowOutput()); + dwTemp.replaceColumn("condition_plan", "", CurPage.getObjectWindowOutput()); dwTemp.replaceColumn("even_subsection", "", CurPage.getObjectWindowOutput()); dwTemp.replaceColumn("knowing_config", "", CurPage.getObjectWindowOutput()); String businessDate = DateHelper.getBusinessDate(); @@ -172,7 +160,6 @@ $(function(){ rentOrRateOption=$("#RENT_OR_RATE").children(); incomeNumberYear=$("#INCOME_NUMBER_YEAR").children(); adjustType=$("#ADJUST_TYPE").children(); - console.info(calcRules); var fundRules=calcRules["fund"]; for(var key in fundRules){ $("#"+key).bind("change",function(){ @@ -183,7 +170,10 @@ $(function(){ getRatioByMoney(this); }); } - } + } + $("#EQUIP_AMT,#INSURANCE_PREMIUM,#EQUIP_END_VALUE,#OTHER_MONEY").bind("change",function(){ + getRatioByMoney(this); + }); CalcControl.PeriodTypeView(); CalcControl.SettleMethodView(); changeSettleMethod2(); @@ -193,7 +183,7 @@ $(function(){ }else{ changeSettleMethod3(); } - + getRatioByMoney(getObj(0, "EQUIP_AMT")); }); function importCustomerQuot(){ @@ -215,6 +205,21 @@ function importCustomerQuot(){ } +function changeRateTypeNew() { + if("ratetype01" == getItemValue(0, 0, "RATE_TYPE")) { + setItemRequired(0, "ADJUST_STYLE", true); + setItemReadOnly(0, 0, "ADJUST_STYLE", false); + setItemRequired(0, "ADJUST_TYPE", true); + setItemReadOnly(0, 0, "ADJUST_TYPE", false); + } else { + setItemValue(0, 0, "ADJUST_STYLE", ""); + setItemRequired(0, "ADJUST_STYLE", false); + setItemReadOnly(0, 0, "ADJUST_STYLE", true); + setItemValue(0, 0, "ADJUST_TYPE", ""); + setItemRequired(0, "ADJUST_TYPE", false); + setItemReadOnly(0, 0, "ADJUST_TYPE", true); + } +} var CalcControl={}; CalcControl.IncomeNumberView=function(){ @@ -250,6 +255,8 @@ CalcControl.IncomeNumberInit=function(){ CalcControl.InitStartDate(); } } + + CalcControl.InitLsaseTerm=function(){ var INCOME_NUMBER_YEAR = getItemValue(0,0,"INCOME_NUMBER_YEAR");// 还款间隔 var INCOME_INTERVAL_MONTH = getItemValue(0,getRow(),"INCOME_INTERVAL_MONTH");//还款间隔(月) @@ -358,7 +365,7 @@ CalcControl.RateFloatTypeInit=function(){ CalcControl.SettleMethodView=function(){ var method=getItemValue(0,getRow(),"SETTLE_METHOD"); //按计算方式 显示按钮 和分段测算录入页面 - document.all("A_Group_even_subsection").style.display="none"; + //document.all("A_Group_even_subsection").style.display="none"; if("true"=="<%=isShowButton%>"){ var button = document.getElementById("InfoButtonArea").getElementsByTagName('a')[0]; if(method == 'irregular_rent'){ @@ -397,11 +404,11 @@ CalcControl.SettleMethodView=function(){ //日期 //计划日期 - var plan; + var plan = ""; if(method=="even_subsection"||method=="irregular_rent"||method==""){ plan=""; }else{ - plan=calcRules['method'][method]["date_proc"].split(","); + //plan=calcRules['method'][method]["date_proc"].split(","); } var planflag={}; for(var i=0;i" == "2"){ - setItemValue(0,0,"CLEAN_LEASE_MONEY",cleanLeaseMoney); - if(!getItemValue(0,getRow(),"CLEAN_LEASE_MONEY")){ - setItemValue(0,0,"CLEAN_LEASE_MONEY",0); + if(e.value === "") { + setItemValue(0, 0, e.id, "0"); + } + var equipAmt = getItemValue(0,0,"EQUIP_AMT");//设备款 + var cleanLeaseMoney = getItemValue(0,0,"CLEAN_LEASE_MONEY");//融资额 + var fundRules = calcRules["fund"]; + var firstPayment = getItemValue(0,0,"FIRST_PAYMENT");//首付款 + if(e.id == "FIRST_PAYMENT_RATIO_0") { + if(e.value) { + firstPayment = Number(e.value) / 100 * Number(equipAmt); + } else { + firstPayment = 0; } } + //计算融资额与总价款 + var allMoney = Number(equipAmt) + Number(getItemValue(0, 0, "INSURANCE_PREMIUM")) + Number(getItemValue(0, 0, "OTHER_MONEY")); + setItemValue(0, 0, "TOTAL_ALL", allMoney + ""); + cleanLeaseMoney = allMoney - firstPayment - Number(getItemValue(0, 0, "EQUIP_END_VALUE")); + setItemValue(0, 0, "CLEAN_LEASE_MONEY", cleanLeaseMoney + "") + for(var key in fundRules){ if(key=="EQUIP_AMT"){ continue; @@ -1234,16 +1250,6 @@ var fundError={}; catch(e){} } } - //传统业务 融资额计算 -function calcRaisedForTraditional(){ - var EquipAmt = getItemValue(0,0,'EQUIP_AMT');//租赁物成本 - var InsurancePermium = getItemValue(0,0,'INSURANCE_PREMIUM');//保险费 - var otherIncome = getItemValue(0,0,'OTHER_INCOME');//其他收入 - var FirstPayment = getItemValue(0,0,'FIRST_PAYMENT');//首付款 - var abc = Number(EquipAmt ? EquipAmt : 0 ); - var cleanLeaseMoney = (Number(EquipAmt ? EquipAmt : 0 )-Number(FirstPayment ? FirstPayment : 0 )+Number(InsurancePermium ? InsurancePermium : 0 )+Number(otherIncome ? otherIncome : 0 )).toFixed(2); - setItemValue(0,0,'CLEAN_LEASE_MONEY',cleanLeaseMoney); - } jQuery.validator.prototype.showLabel = function(element,message){ var id=element.getAttribute('id'); if(element.getAttribute('errorInfo')){ diff --git a/WebContent/Accounting/LoanSimulation/condition_plan_business.jsp b/WebContent/Accounting/LoanSimulation/condition_plan_business.jsp new file mode 100644 index 000000000..def048727 --- /dev/null +++ b/WebContent/Accounting/LoanSimulation/condition_plan_business.jsp @@ -0,0 +1,23 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/IncludeBegin.jsp"%> +<% + String flowunid = CurPage.getParameter("flowunid"); + String plannumber=CurPage.getParameter("plannumber"); + String planCName=CurPage.getParameter("planCName"); + String calType=CurPage.getParameter("calType"); + String IsHistory=CurPage.getParameter("IsHistory"); + String RightType=CurPage.getParameter("RightType"); + String productId=CurPage.getParameter("ProductId"); + + String params="flowunid="+flowunid+"&plannumber="+plannumber+"&planCName="+planCName+"&calType="+calType+"&IsHistory="+IsHistory+"&RightType="+RightType+"&ProductId="+productId; + //参数:0.是否显示, 1.标题,2.URL,3,参数串, 4. Strip高度(默认600px),5. 是否有关闭按钮(默认无) 6. 是否缓存(默认是) +// String userid = CurUser.getUserID(); + String orgid = CurUser.getOrgID(); + String sTabStrip[][] = { + {"true", "租金计划", "/Accounting/LoanSimulation/RentPlanList.jsp",params, "", "", "false"}, + {"true", "资金计划", "/Accounting/LoanSimulation/FundPlanList.jsp",params, "", "", "false"}, + {"true", "现金流", "/Accounting/LoanSimulation/CashFlowList.jsp",params, "", "", "false"}, + }; +%> +<%@ include file="/Resources/CodeParts/Tab01.jsp"%> +<%@ include file="/IncludeEnd.jsp"%> \ No newline at end of file diff --git a/calc/com/tenwa/reckon/bean/TabCalBean.java b/calc/com/tenwa/reckon/bean/TabCalBean.java index d7418d86b..98546fbbb 100644 --- a/calc/com/tenwa/reckon/bean/TabCalBean.java +++ b/calc/com/tenwa/reckon/bean/TabCalBean.java @@ -47,7 +47,16 @@ public class TabCalBean { private String view_type = "table";// view为从表都是视图出,table都从表出,默认从table private String docId; private String productId; + private String productType; + public String getProductType() { + return productType; + } + + public void setProductType(String productType) { + this.productType = productType; + } + public String getProductId() { return productId; } diff --git a/calc/com/tenwa/reckon/executor/CreateTransactionExecutor.java b/calc/com/tenwa/reckon/executor/CreateTransactionExecutor.java index 9b6e1e373..6b9d6d621 100644 --- a/calc/com/tenwa/reckon/executor/CreateTransactionExecutor.java +++ b/calc/com/tenwa/reckon/executor/CreateTransactionExecutor.java @@ -113,6 +113,15 @@ public class CreateTransactionExecutor implements Transaction { if(bean.getCb().getRentOrRate().equals("rent")&&new BigDecimal(bean.getCb().getIncomeNumber()).multiply(new BigDecimal(bean.getCb().getRentValue())).compareTo(new BigDecimal(bean.getCb().getCleanLeaseMoney()))<0){ throw new BusinessException("按租金算年利率租金总和必须大于融资额"); } + //获取产品类型 + com.amarsoft.awe.util.Transaction Sqlca = com.amarsoft.awe.util.Transaction.createTransaction(tx); + String productType = Sqlca.getString(new SqlObject("select attribute2 from business_type where typeno='"+productId+"'")); + bean.setProductType(productType); + + if("business_product".equals(productType)) { + bean.getCb().setCleanLeaseMoney(new BigDecimal(bean.getCb().getCleanLeaseMoney()).add(new BigDecimal(bean.getCb().getEquipEndValue())).toString()); + } + jsonObject.appendElement("year_rate", bean.getCb().getYearRate()); FundRentPlanBean rentPlan = this.createRentPlan(bean,tx); this.createFundPlan(rentPlan, bean,tx); diff --git a/calc/com/tenwa/reckon/executor/FundFundPlanExecutor.java b/calc/com/tenwa/reckon/executor/FundFundPlanExecutor.java index fe2c8d105..fa7cdbd8f 100644 --- a/calc/com/tenwa/reckon/executor/FundFundPlanExecutor.java +++ b/calc/com/tenwa/reckon/executor/FundFundPlanExecutor.java @@ -177,6 +177,12 @@ public class FundFundPlanExecutor { if(entry.getKey().indexOf("feetype")>=0){ continue; } + //如果是传统业务必须保留期末余值逻辑 + if(!"business_product".equals(tcb.getProductType()) + && "EQUIP_END_VALUE".equals(key)) { + continue; + } + //取值 BigDecimal temp =new BigDecimal(con.getAttribute(key).getDouble()); Item item = null; diff --git a/calc/com/tenwa/reckon/product/ProductCondition.java b/calc/com/tenwa/reckon/product/ProductCondition.java index a88631941..3005a1e75 100644 --- a/calc/com/tenwa/reckon/product/ProductCondition.java +++ b/calc/com/tenwa/reckon/product/ProductCondition.java @@ -49,6 +49,24 @@ public class ProductCondition { return sb.toString(); } + public String getProductRulesBusiness(ASObjectModel doTemp,String productId,Vector vali) throws Exception{ + doTemp.setDefaultValue("LEASE_AMT_DATE", DateUtil.getToday()); + StringBuilder sb=new StringBuilder(); + sb.append("{"); + sb.append("'fund':"+getProductFundRules(doTemp, productId,vali));//资金配置项 + sb.append(",'grace':"+this.getProductGraceRules(doTemp, productId, vali));//宽限期 + sb.append(",'method':"+this.getProductSettleRulesBusiness(doTemp, productId));//计算方式 + sb.append("}"); + setRentOrRate(doTemp, productId);//租金推算方法 + this.getOtherRule(doTemp, productId);//其它配置 + this.getProductPenaRules(doTemp, productId);//罚息 + this.getProductAdjustRules(doTemp, productId);//调息 + this.getGrossRules(doTemp, productId);// + //this.setDateRule(doTemp, productId);//日期 + this.getCautionRatio(doTemp, productId);//保证金比例 + return sb.toString(); + } + public String getProductRulesApp(List> appList,String productId,Vector vali) throws Exception{ ProductBaseLoanTools.addAppList(appList, "LEASE_AMT_DATE", "coldefaultvalue", DateUtil.getToday()); StringBuilder sb=new StringBuilder(); @@ -727,6 +745,68 @@ public class ProductCondition { return "{"+sJson+"}"; } + /** + * 设置计算方式 + * @param doTemp + * @param productId + * @return + * @throws Exception + */ + public String getProductSettleRulesBusiness(ASObjectModel doTemp,String productId) throws Exception{ + + //租金计算方式 + Map> map=ProductParamUtil.getProductComponentType(productId, "PRD0301"); + //分段 + Map> submap=ProductParamUtil.getProductComponentType(productId, "PRD0321"); + String s=""; + + String sJson=""; + for(Map.Entry> entry:map.entrySet()){ + if(s.length()>0)s+=","; + s+="'"+entry.getKey()+"'"; + if(sJson.length()>0)sJson+=","; + sJson+="'"+entry.getKey()+"':"+FileOperatorUtil.getMapToJsonStr(entry.getValue()); + + if(entry.getKey().equals( doTemp.getColumnAttribute("SETTLE_METHOD", "coldefaultvalue"))){ + Map values=entry.getValue(); + if(values.containsKey("HolidayAdjust")){ + doTemp.setDefaultValue("PLAN_DATE_HOILDAY", values.get("HolidayAdjust")); + } + if(values.containsKey("InterestHolidayAdjust")){ + doTemp.setDefaultValue("INTEREST_DATE_HOLIDAY", values.get("InterestHolidayAdjust")); + } + if(values.containsKey("RATE")){ + doTemp.setDefaultValue("RATE", values.get("RATE")); + } + if(values.containsKey("AdditionalRate")){ + doTemp.setDefaultValue("ADDITIONAL_RATE", values.get("AdditionalRate")); + } + if(values.containsKey("InterestDayType")){ + doTemp.setDefaultValue("INTEREST_DAY_TYPE", values.get("InterestDayType")); + } + } + } + if(submap.containsKey("ISSUBSECTION")){ + if(s.length()>0)s+=","; + s+="'even_subsection'"; + } + + /*if(s.indexOf("even_rent") != -1) { + s = "'even_rent'"; + } else if(s.indexOf("even_corpus") != -1) { + s = "'even_corpus'"; + } else { + s = "'even_interest'"; + }*/ + // doTemp.setReadOnly("SETTLE_METHOD", true); + doTemp.setColumnAttribute("SETTLE_METHOD","coleditsource","jbo.sys.CODE_LIBRARY,itemno,itemname,codeno='settle_method' and itemno in ("+s+") order by sortno"); + doTemp.setDefaultValue("SETTLE_METHOD", s.replaceAll("'", "")); + + + return "{"+sJson+"}"; + } + + public String getProductSettleRulesApp(List> appList,String productId) throws Exception{ //租金计算方式 diff --git a/calc/com/tenwa/reckon/util/TbBeanTools.java b/calc/com/tenwa/reckon/util/TbBeanTools.java index 90f58b146..cfc61ffd9 100644 --- a/calc/com/tenwa/reckon/util/TbBeanTools.java +++ b/calc/com/tenwa/reckon/util/TbBeanTools.java @@ -10,6 +10,7 @@ import com.amarsoft.are.jbo.BizObject; import com.amarsoft.are.jbo.BizObjectManager; import com.amarsoft.are.jbo.JBOFactory; import com.amarsoft.are.log.Log; +import com.amarsoft.awe.util.SqlObject; import com.tenwa.reckon.bean.KnowingConfigBean; import com.tenwa.reckon.bean.KnowingTableBean; import com.tenwa.reckon.bean.SubsectionBean;