修改安鹏传统业务测算

This commit is contained in:
zhulianghua 2018-09-14 10:04:47 +08:00
parent 8f387a1517
commit b625c16d47
7 changed files with 177 additions and 43 deletions

View File

@ -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", "<iframe type='iframe' id='frame_list' name=\"frame_list\" width=\"100%\" height=\"600px\" frameborder=\"0\" src=\""+sWebRootPath+"/Accounting/LoanSimulation/condition_plan.jsp?CompClientID="+compClientID+"&flowunid="+flowunid+"&plannumber="+plannumber+"&planCName="+planCName+"&IsHistory="+ishistory+"&NodeNo="+nodeNo+"&RightType="+RightType+"&ProductId="+productId+"&calType="+calType+"\"></iframe>", CurPage.getObjectWindowOutput());
dwTemp.replaceColumn("condition_plan", "<iframe type='iframe' id='frame_list' name=\"frame_list\" width=\"100%\" height=\"600px\" frameborder=\"0\" src=\""+sWebRootPath+"/Accounting/LoanSimulation/condition_plan_business.jsp?CompClientID="+compClientID+"&flowunid="+flowunid+"&plannumber="+plannumber+"&planCName="+planCName+"&IsHistory="+ishistory+"&NodeNo="+nodeNo+"&RightType="+RightType+"&ProductId="+productId+"&calType="+calType+"\"></iframe>", CurPage.getObjectWindowOutput());
dwTemp.replaceColumn("even_subsection", "<iframe type='iframe' id='frame_even_break' name=\"frame_even_subsection\" width=\"100%\" height=\"300px\" frameborder=\"0\" src=\""+sWebRootPath+"/Accounting/LoanSimulation/subsection/LCCalcSubsectionList.jsp?CompClientID="+compClientID+"&flowunid="+flowunid+"&plannumber="+plannumber+"&planCName="+planCName+"&IsHistory="+ishistory+"&NodeNo="+nodeNo+"&RightType="+RightType+"&calType="+calType+"\"></iframe>", CurPage.getObjectWindowOutput());
dwTemp.replaceColumn("knowing_config", "<iframe type='iframe' id='frame_list_knowing' name=\"frame_list_knowing\" width=\"100%\" height=\"400px\" frameborder=\"0\" src=\""+sWebRootPath+"/Accounting/LoanSimulation/KnowConfigList.jsp?CompClientID="+compClientID+"&flowunid="+flowunid+"&plannumber="+plannumber+"&planCName="+planCName+"&IsHistory="+ishistory+"NodeNo="+nodeNo+"&RightType="+RightType+"&calType="+calType+"\"></iframe>", 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<plan.length;i++){
@ -434,11 +441,11 @@ CalcControl.SettleMethodView=function(){
}
}
//计息日期
var interest;
var interest = "";
if(method=="even_subsection"||method=="irregular_rent"||method==""){
interest="";
}else{
interest=calcRules['method'][method]["interest_date_proc"].split(",");
//interest=calcRules['method'][method]["interest_date_proc"].split(",");
}
var interestflag={};
for(var i=0;i<interest.length;i++){
@ -528,7 +535,7 @@ CalcControl.SettleMethodInit=function(){
CalcControl.RentOrRateView=function(){
var rentOrRate = getItemValue(0,getRow(),"RENT_OR_RATE");//租金推算方式
var method=getItemValue(0,getRow(),"SETTLE_METHOD");//租金计算方式
document.all("A_Group_calc_config").style.display="none";
//document.all("A_Group_calc_config").style.display="none";
var ids="RATE_FLOAT_TYPE,BASE_RATE,RATE_FLOAT_AMT,RATE_FLOAT_DAY,YEAR_RATE,RENT_VALUE,INCOME_NUMBER";
var ids2="INCOME_NUMBER_YEAR,PERIOD_TYPE,GRACE,FIRST_PLAN_DATE,SECOND_PLAN_DATE";
setItemRequired(0,"RENT_VALUE",false);
@ -721,17 +728,26 @@ function changeRateType(){
//根据金额算比例
function getRatioByMoney(e){
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");//首付款
cleanLeaseMoney=Number(equipAmt)-Number(firstPayment);
if("<%=productType%>" == "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");//<2F>구운
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')){

View File

@ -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.URL3参数串, 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"%>

View File

@ -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;
}

View File

@ -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);

View File

@ -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;

View File

@ -49,6 +49,24 @@ public class ProductCondition {
return sb.toString();
}
public String getProductRulesBusiness(ASObjectModel doTemp,String productId,Vector<ValidateRule> 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<Map<String, Object>> appList,String productId,Vector<ValidateRule> 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<String,Map<String,String>> map=ProductParamUtil.getProductComponentType(productId, "PRD0301");
//分段
Map<String,Map<String,String>> submap=ProductParamUtil.getProductComponentType(productId, "PRD0321");
String s="";
String sJson="";
for(Map.Entry<String,Map<String,String>> 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<String,String> 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<Map<String, Object>> appList,String productId) throws Exception{
//租金计算方式

View File

@ -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;