diff --git a/WebContent/Accounting/LoanSimulation/LoanBasicInfo.jsp b/WebContent/Accounting/LoanSimulation/LoanBasicInfo.jsp
index 71e4ea43a..9c0bf4012 100644
--- a/WebContent/Accounting/LoanSimulation/LoanBasicInfo.jsp
+++ b/WebContent/Accounting/LoanSimulation/LoanBasicInfo.jsp
@@ -89,6 +89,7 @@
doTemp.setHtmlEvent("BASE_RATE", "onchange", "changeBaseRate");//基准利率
doTemp.setHtmlEvent("RATE_FLOAT_AMT", "onchange", "changeRateFloatAmt");//利率调整值
doTemp.setHtmlEvent("CAUTION_MONEY", "onchange", "cautionMoney");//保证金
+ doTemp.setHtmlEvent("CAUTION_MONEY_METHOD", "onchange", "cautionMoney");//保证金
doTemp.setHtmlEvent("CAUTION_DEDUCTION_MONEY", "onchange", "cautionDeductionMoney");//保证金抵扣金额
doTemp.setHtmlEvent("LEASE_AMT_DATE", "onchange", "changeLeaseAmtDate");//投放日
doTemp.setHtmlEvent("START_DATE", "onchange", "changeStartDate");//起租日
@@ -152,8 +153,8 @@
String compClientID = request.getParameter("CompClientID");
dwTemp.replaceColumn("condition_plan", "", CurPage.getObjectWindowOutput());
- dwTemp.replaceColumn("even_subsection", "", CurPage.getObjectWindowOutput());
- dwTemp.replaceColumn("knowing_config", "", CurPage.getObjectWindowOutput());
+ //dwTemp.replaceColumn("even_subsection", "", CurPage.getObjectWindowOutput());
+ //dwTemp.replaceColumn("knowing_config", "", CurPage.getObjectWindowOutput());
String businessDate = DateHelper.getBusinessDate();
//获取产品名称
BizObject bo = JBOFactory.createBizObjectQuery(BUSINESS_TYPE.CLASS_NAME,"typeno=:productID")
@@ -174,37 +175,39 @@ var count = 0;
$(function(){
var productName="<%=productName%>";
setItemValue(0,0,"PRODUCT_NAME",productName);
- isFina();
//document.getElementById('div_my0').innerHTML = '
'+document.getElementById('div_my0').innerHTML+'
';
if("ReadOnly"!="<%=RightType%>"){
- debugger;
+ CalcControl.InitStartDate();
rentOrRateOption=$("#RENT_OR_RATE").children();
incomeNumberYear=$("#INCOME_NUMBER_YEAR").children();
adjustType=$("#ADJUST_TYPE").children();
- console.info(calcRules);
-
var fundRules=calcRules["fund"];
+ console.log(fundRules);
for(var key in fundRules){
- $("#"+key).bind("change",function(){
+ $("#"+key).bind("change",function(){
+ getRatioByMoney(this);
+ });
+ if($("#"+key+"_FINA").length > 0){
+ $("#"+key+"_FINA").bind("change",function(){
getRatioByMoney(this);
});
- if($("#"+key+"_FINA").length > 0){
- $("#"+key+"_FINA").bind("change",function(){
- getRatioByMoney(this);
- });
- }
- }
- CalcControl.InitLsaseTerm();
- CalcControl.PeriodTypeView();
- CalcControl.SettleMethodView();
- changeSettleMethod2();
- changeRateType();
- CalcControl.RentOrRateView();
+ }
+ }
+ $("#EQUIP_AMT").bind("change", function() {
+ getRatioByMoney(this);
+ });
+ //CalcControl.InitLsaseTerm();
+ //CalcControl.PeriodTypeView();
+ //CalcControl.SettleMethodView();
+ //changeSettleMethod2();
+ //changeRateType();
+ //CalcControl.RentOrRateView();
count++;
}else{
changeSettleMethod3();
- }
+ }
+ getRatioByMoney(getObj(0, "EQUIP_AMT"));
});
function isFina(){
var fundRules=calcRules["fund"];
@@ -286,11 +289,24 @@ CalcControl.InitLsaseTerm=function(){
CalcControl.InitStartDate=function(){
var leaseAmtDate=getItemValue(0,getRow(),"LEASE_AMT_DATE");//投放日
var startDate=getItemValue(0,getRow(),"START_DATE");//起租日
+ var periodType=getItemValue(0,getRow(),"PERIOD_TYPE");//期初期末
+ var incomenumberyear=getItemValue(0,getRow(),"INCOME_NUMBER_YEAR").split("_")[1];//还款间隔
+ var rentDay=getItemValue(0,getRow(0),"DEFAULTDUEDAY");//还款日
+
//默认起租日为投放日
- if(startDate.length==""){
- setItemValue(0,0,"START_DATE",leaseAmtDate);
+ if("period_type_1" == periodType){//期初 第一期还款日为投放日
+ setItemValue(0,0,"FIRST_PLAN_DATE",leaseAmtDate);
+ setItemValue(0,0,"SECOND_PLAN_DATE",dateAdd('m',incomenumberyear,new Date(startDate)).format('yyyy\/MM\/dd'));
+ }else{
+ var firstPlanDate = dateAdd('m',incomenumberyear,new Date(startDate)).format('yyyy\/MM\/dd');
+ if(Number(rentDay)<10){
+ firstPlanDate=firstPlanDate.substring(0,8)+"0"+rentDay;
+ }else{
+ firstPlanDate=firstPlanDate.substring(0,8)+rentDay;
+ }
+ setItemValue(0,0,"FIRST_PLAN_DATE",firstPlanDate);
+ setItemValue(0,0,"SECOND_PLAN_DATE",dateAdd('m',incomenumberyear,new Date(firstPlanDate)).format('yyyy\/MM\/dd'));
}
- CalcControl.InitFistPlanDate();
}
CalcControl.InitFistPlanDate=function(){
@@ -741,29 +757,40 @@ function changeRateType(){
//根据金额算比例
function getRatioByMoney(e){
-
var equipAmt=getItemValue(0,0,"EQUIP_AMT");//设备款
var cleanLeaseMoney=getItemValue(0,0,"CLEAN_LEASE_MONEY");//融资额
+ var allMoney = equipAmt;
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);
+
+ for(var key in fundRules) {
+ var fundMoney = getItemValue(0,0,key);//金额
+ if(typeof(fundRules[key]["financing"]) != "undefined" && fundRules[key]["financing"] == "true") {
+ if(fundMoney == "") {
+ fundMoney = 0;
+ setItemValue(0, 0, key, "0");
+ }
+ allMoney = eval(allMoney + "+" + fundMoney);
}
- }
- for(var key in fundRules){
- if(key=="EQUIP_AMT"){
- continue;
- }
- var fundMoney=getItemValue(0,0,key);//金额
- var fundRatio=getItemValue(0,0,key+"_RATIO");// 比例
var fundFina=getItemValue(0,0,key+"_FINA");// 是否参与融资
if(fundFina == "finatype02" || fundFina == "finatype03"){
- setItemValue(0,0,"CLEAN_LEASE_MONEY",Number(cleanLeaseMoney)+Number(fundMoney));
- cleanLeaseMoney = Number(cleanLeaseMoney)+Number(fundMoney);
+ allMoney = Number(allMoney)+Number(fundMoney);
}
+ }
+ //得到总价款
+ setItemValue(0, 0, "TOTAL_ALL", allMoney + "");
+ //计算综合融资额
+ var firstPaymentRatio = getItemValue(0, 0, "FIRST_PAYMENT_RATIO_0");
+ var ratio = 100 - Number(firstPaymentRatio);
+ if(ratio > 0 && allMoney != 0) {
+ cleanLeaseMoney = allMoney * (ratio / 100);
+ setItemValue(0, 0, "RENT_RATIO", ((cleanLeaseMoney / equipAmt) * 100).toFixed(6));
+ setItemValue(0, 0, "CLEAN_LEASE_MONEY", cleanLeaseMoney);
+ }
+
+ for(var key in fundRules){
+ var fundMoney=getItemValue(0,0,key);//金额
+ var fundRatio=getItemValue(0,0,key+"_RATIO");// 比例
+
var money=0;
if(fundRules[key]["ratioFee"]=="EquipEndAmt"&&key!="FIRST_PAYMENT"){//比例参照项
@@ -797,6 +824,12 @@ function getRatioByMoney(e){
}
}
}
+ var firstPayment = Number(getItemValue(0, 0, "FIRST_PAYMENT"));
+ if(allMoney != 0 && firstPayment != 0) {
+ setItemValue(0, 0, "ALL_FIRST_PAYMENT", firstPayment + "");
+ setItemValue(0, 0, "ALL_FIRST_PAYMENT_RATIO", ((firstPayment / allMoney) * 100).toFixed(6));
+ setItemValue(0, 0, "ALL_FIRST_PAYMENT_RATIO_0", ((firstPayment / allMoney) * 100).toFixed(6));
+ }
cautionMoney();
}
//根据比例算金额
@@ -977,6 +1010,14 @@ function setDisable(ids){
//保证金事件
function cautionMoney(){
var cautionMoney = getItemValue(0,getRow(),"CAUTION_MONEY");//保证金
+ var cautionMoneyMethod = getItemValue(0,getRow(),"CAUTION_MONEY_METHOD");//保证金期末处理方式
+ if("caution_money_method01" == cautionMoneyMethod) {
+ setItemValue(0, 0, "CAUTION_DEDUCTION_MONEY", cautionMoney);
+ setItemValue(0, 0, "CAUTION_MONEY_REMAIN", "0");
+ } else if("caution_money_method02" == cautionMoneyMethod) {
+ setItemValue(0, 0, "CAUTION_DEDUCTION_MONEY", "0");
+ setItemValue(0, 0, "CAUTION_MONEY_REMAIN", cautionMoney);
+ }
var cautionDeductionMoney = getItemValue(0,getRow(),"CAUTION_DEDUCTION_MONEY");//保证金抵扣
var cautionMoneyRemain=getItemValue(0,getRow(),"CAUTION_MONEY_REMAIN");//保证金退还
if(Number(cautionMoneyRemain)==Number(cautionMoney)-Number(cautionDeductionMoney)){
@@ -987,7 +1028,7 @@ function cautionMoney(){
cautionMoneyRemain=Number(cautionMoney)-Number(cautionDeductionMoney);//保证金退还
if(cautionMoneyRemain<0){
setItemValue(0,0,"CAUTION_DEDUCTION_MONEY",cautionMoney);
- alert("保证金退还金额填写过大!");
+ AsDebug.alert("提示", "保证金退还金额填写过大!");
return;
}else{
setItemValue(0,0,"CAUTION_MONEY_REMAIN",cautionMoneyRemain);
diff --git a/WebContent/WEB-INF/etc/app/component/component-config.xml b/WebContent/WEB-INF/etc/app/component/component-config.xml
index ab6cabd08..c34ad3fdb 100644
--- a/WebContent/WEB-INF/etc/app/component/component-config.xml
+++ b/WebContent/WEB-INF/etc/app/component/component-config.xml
@@ -27,7 +27,7 @@
-
+
@@ -66,7 +66,7 @@
-
+
@@ -1078,7 +1078,7 @@
-
+
@@ -1097,12 +1097,12 @@
-
+
-
+
-
-
\ No newline at end of file
+
+
\ No newline at end of file
diff --git a/WebContent/WEB-INF/etc/app/component/component-parameter-config.xml b/WebContent/WEB-INF/etc/app/component/component-parameter-config.xml
index 54e597ee3..08fb1c5cb 100644
--- a/WebContent/WEB-INF/etc/app/component/component-parameter-config.xml
+++ b/WebContent/WEB-INF/etc/app/component/component-parameter-config.xml
@@ -196,4 +196,4 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/WebContent/WEB-INF/etc/jbo/jbo_calc.xml b/WebContent/WEB-INF/etc/jbo/jbo_calc.xml
index e96f40a55..49c96a114 100644
--- a/WebContent/WEB-INF/etc/jbo/jbo_calc.xml
+++ b/WebContent/WEB-INF/etc/jbo/jbo_calc.xml
@@ -2944,8 +2944,8 @@
-
-
+
+
@@ -2963,7 +2963,12 @@
-
+
+
+
+
+
+
diff --git a/calc/com/tenwa/reckon/bean/ConditionBean.java b/calc/com/tenwa/reckon/bean/ConditionBean.java
index 37f442fec..fd41bd09f 100644
--- a/calc/com/tenwa/reckon/bean/ConditionBean.java
+++ b/calc/com/tenwa/reckon/bean/ConditionBean.java
@@ -157,9 +157,10 @@ public class ConditionBean implements Cloneable{
private String factoryAccessories; // 原厂配件费
private String factoryAccessoriesFina;// 原厂配件费是否参与融资
private BigDecimal share; // 分摊本金
- private BigDecimal retainage; // 尾款
+ //private BigDecimal retainage; // 尾款
private String corpusType; // 还本方式
private String corpus; // 期限内本金
+ private String finalPayment; //尾款
//**********************************************************************【众联车贷测算参与融资资金项结束!】
/***********************************************************************************
@@ -1684,12 +1685,12 @@ public class ConditionBean implements Cloneable{
public void setShare(BigDecimal share) {
this.share = share;
}
- public BigDecimal getRetainage() {
+ /*public BigDecimal getRetainage() {
return retainage;
}
public void setRetainage(BigDecimal retainage) {
this.retainage = retainage;
- }
+ }*/
public String getCorpusType() {
return corpusType;
}
@@ -1702,4 +1703,10 @@ public class ConditionBean implements Cloneable{
public void setCorpus(String corpus) {
this.corpus = corpus;
}
+ public String getFinalPayment() {
+ return finalPayment;
+ }
+ public void setFinalPayment(String finalPayment) {
+ this.finalPayment = finalPayment;
+ }
}
diff --git a/calc/com/tenwa/reckon/executor/FundFundPlanExecutor.java b/calc/com/tenwa/reckon/executor/FundFundPlanExecutor.java
index 56c6d9948..aed2b9f4b 100644
--- a/calc/com/tenwa/reckon/executor/FundFundPlanExecutor.java
+++ b/calc/com/tenwa/reckon/executor/FundFundPlanExecutor.java
@@ -1,6 +1,8 @@
package com.tenwa.reckon.executor;
import java.math.BigDecimal;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -15,22 +17,26 @@ import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.BizObjectManager;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.are.jbo.JBOTransaction;
+import com.amarsoft.dict.als.cache.CodeCache;
+import com.amarsoft.dict.als.object.Item;
+import com.tenwa.comm.exception.BusinessException;
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
import com.tenwa.reckon.bean.ConditionBean;
import com.tenwa.reckon.bean.FundPlanBean;
import com.tenwa.reckon.bean.FundRentPlanBean;
import com.tenwa.reckon.bean.TabCalBean;
+import com.tenwa.reckon.util.UUIDUtil;
public class FundFundPlanExecutor {
public void run(ConditionBean cb , TabCalBean tcb,FundRentPlanBean rentPlan,JBOTransaction tx) throws Exception{
cb.setDocId(tcb.getDocId());
List fundPlanBeans=new ArrayList();
- /*if(Double.parseDouble(cb.getCautionMoney()) > 0 ){
+ if(Double.parseDouble(cb.getCautionMoney()) > 0 ){
fundPlanBeans = splitFundFundPlan(rentPlan, cb, "", "feetype17","feetype16");
- }else{*/
- //cb.setDeductionLastPlanDate(cb.getLastPlanDate());//不生成保证金抵扣及退还计划
- //}
+ }else{
+ cb.setDeductionLastPlanDate(cb.getLastPlanDate());//不生成保证金抵扣及退还计划
+ }
fundPlanBeans = this.create(tcb,fundPlanBeans,tx);
this.delete(tcb,tx);
this.add(fundPlanBeans, tcb,tx);
@@ -60,33 +66,43 @@ public class FundFundPlanExecutor {
BizObject con=tcb.getCondition();
ConditionBean cb=tcb.getCb();
- String sql="select itemno from O where codeno='FeeType' and relativecode=:code";
+ //String sql="select itemno from O where codeno='FeeType' and relativecode=:code";
+ Item[] items = CodeCache.getItems("FeeType");
for(Map.Entry> entry:map.entrySet()){
Map param=entry.getValue();
+ String key = entry.getKey();
if(entry.getKey().indexOf("feetype")>=0){
continue;
}
//取值
- BigDecimal temp =new BigDecimal(con.getAttribute(entry.getKey()).getDouble());
- BizObject item=JBOFactory.createBizObjectQuery(CODE_LIBRARY.CLASS_NAME, sql).setParameter("code", entry.getKey()).getSingleResult(false);
+ BigDecimal temp =new BigDecimal(con.getAttribute(key).getDouble());
+ Item item = null;
+ for(Item it : items) {
+ if(key.equals(it.getRelativeCode())) {
+ item = it;
+ break;
+ }
+ }
+
+ //BizObject item=JBOFactory.createBizObjectQuery(CODE_LIBRARY.CLASS_NAME, sql).setParameter("code", entry.getKey()).getSingleResult(false);
if (item!=null && temp.compareTo(BigDecimal.ZERO)>0) {
FundPlanBean ffcp = new FundPlanBean();
if("onHire_process".equals(tcb.getCalType())){
BizObjectManager bomLFP = JBOFactory.getBizObjectManager(LC_FUND_PLAN.CLASS_NAME,tx);
- BizObject boLFP = bomLFP.createQuery("select id from O where contract_id='"+tcb.getCb().getContractId()+"' and fee_type='"+item.getAttribute("itemno").getString()+"'")
+ BizObject boLFP = bomLFP.createQuery("select id from O where contract_id='"+tcb.getCb().getContractId()+"' and fee_type='"+item.getItemNo()+"'")
.getSingleResult(true);
ffcp.setId(boLFP.getAttribute("id").getString());
bomLFP.deleteObject(boLFP);
}
- ffcp.setFeeType(item.getAttribute("itemno").getString());//费用类型
+ ffcp.setFeeType(item.getItemNo());//费用类型
ffcp.setPlanList("1");
ffcp.setSettleMethod("payfund6");
ffcp.setPayType(StringUtil.nullToString(param.get("CostType01")).length()>0?param.get("CostType01"):"pay_type_in");
if("NOMINAL_PRICE".equals(entry.getKey())){
param.put("CostType02", "PaymentTime7");
}
- if("FIRST_PAYMENT".equals(entry.getKey())){
- param.put("CostType02", "PaymentTime1");
+ if("feetype5".equals(item.getItemNo()) && "".equals(StringUtil.nullToString(param.get("CostType02")))) {
+ continue;
}
ffcp.setPlanDate(this.getPlanDate(StringUtil.nullToString(param.get("CostType02")), cb));
ffcp.setPlanMoney(temp.toString());
@@ -98,7 +114,7 @@ public class FundFundPlanExecutor {
if(con.getAttribute(entry.getKey()).getString().equals("N"))
{
FundPlanBean ffcp2 = new FundPlanBean();
- ffcp2.setFeeType(item.getAttribute("itemno").getString());//费用类型
+ ffcp2.setFeeType(item.getItemNo());//费用类型
ffcp2.setPlanList("1");
ffcp2.setSettleMethod("payfund6");
ffcp2.setPayType(ffcp.getPayType().equals("pay_type_in")?"pay_type_out":"pay_type_in");
@@ -123,7 +139,39 @@ public class FundFundPlanExecutor {
//保存资金计划到表
private void add(List fp,TabCalBean tcb,JBOTransaction tx) throws Exception{
- BizObjectManager bm=JBOFactory.getBizObjectManager(tcb.getFundFundPlan_tb(), tx);
+ com.amarsoft.awe.util.Transaction tran = com.amarsoft.awe.util.Transaction.createTransaction(tx);
+ Connection conn = tran.getConnection(tran);
+ String Sql = "INSERT INTO " + tcb.getFundFundPlan_tb().substring(tcb.getFundFundPlan_tb().lastIndexOf(".") + 1) + " ("
+ + "id, flowunid, " + tcb.getPlanCName() + ", plan_list, "
+ + "plan_date, FEE_TYPE, PLAN_MONEY, PAY_OBJ, SETTLE_METHOD, PAY_TYPE) "
+ + " VALUES (?,?,?,?,?,?,?,?,?,?)";
+ PreparedStatement ps = null;
+ try {
+ ps = conn.prepareStatement(Sql);
+ for(FundPlanBean fund : fp) {
+ if(fund.getPlanDate() == null){
+ continue;
+ }
+ ps.setString(1, UUIDUtil.getUUID());
+ ps.setString(2, tcb.getDocId());
+ ps.setString(3, tcb.getPlanCValue());
+ ps.setString(4, fund.getPlanList());
+ ps.setString(5, fund.getPlanDate());
+ ps.setString(6, fund.getFeeType());
+ ps.setString(7, fund.getPlanMoney());
+ ps.setString(8, fund.getPayObj());
+ ps.setString(9, fund.getSettleMethod());
+ ps.setString(10, fund.getPayType());
+ ps.addBatch();
+ }
+ ps.executeBatch();
+ } catch(Exception e) {
+ e.printStackTrace();
+ throw new BusinessException("insert fund_plan error");
+ } finally {
+ if(ps != null) ps.close();
+ }
+ /*BizObjectManager bm=JBOFactory.getBizObjectManager(tcb.getFundFundPlan_tb(), tx);
for(FundPlanBean fund : fp){
if(fund.getPlanDate() == null){
continue;
@@ -153,7 +201,7 @@ public class FundFundPlanExecutor {
//fundPlan.setAttributeValue("plan_money_company", new BigDecimal(fundPlan.getAttribute("PLAN_MONEY").getString()).subtract(new BigDecimal(fundPlan.getAttribute("plan_money_union").getString())).toString());
bm.saveObject(fundPlan);
- }
+ }*/
}
//生成抵扣保证金 保证金退还 资金计划
diff --git a/calc/com/tenwa/reckon/executor/FundRentPlanExecutor.java b/calc/com/tenwa/reckon/executor/FundRentPlanExecutor.java
index 768793f24..6132a9f68 100644
--- a/calc/com/tenwa/reckon/executor/FundRentPlanExecutor.java
+++ b/calc/com/tenwa/reckon/executor/FundRentPlanExecutor.java
@@ -1,18 +1,23 @@
package com.tenwa.reckon.executor;
import java.math.BigDecimal;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
import java.util.ArrayList;
import java.util.List;
+
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.BizObjectManager;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.are.jbo.JBOTransaction;
+import com.tenwa.comm.exception.BusinessException;
import com.tenwa.reckon.bean.ConditionBean;
import com.tenwa.reckon.bean.FundRentPlanBean;
import com.tenwa.reckon.bean.TabCalBean;
import com.tenwa.reckon.help.PlanDateServiceImpl;
import com.tenwa.reckon.help.RentPlanContrCalDAOImpl;
import com.tenwa.reckon.util.NumberUtils;
+import com.tenwa.reckon.util.UUIDUtil;
public abstract class FundRentPlanExecutor {
public JBOTransaction tx;
@@ -84,7 +89,43 @@ public abstract class FundRentPlanExecutor {
fpb.setColumn_1(fpb.getCorpusBusinessList());
fpb.setColumn_2(fpb.getInterestBusinessList());
}
- BizObjectManager bm=JBOFactory.getBizObjectManager(tcb.getRentPlan_tb(), tx);
+ com.amarsoft.awe.util.Transaction tran = com.amarsoft.awe.util.Transaction.createTransaction(tx);
+ Connection conn = tran.getConnection(tran);
+ //利用批处理解决测算速度
+ String Sql = "INSERT INTO " + tcb.getRentPlan_tb().substring(tcb.getRentPlan_tb().lastIndexOf(".") + 1) + " ("
+ + "id, flowunid, " + tcb.getPlanCName() + ", plan_list, "
+ + "plan_date, INTEREST_DATE, plan_status, rent, corpus, "
+ + "year_rate, interest, all_remain_corpus, CORPUS_BUSINESS, INTEREST_BUSINESS) "
+ + " VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
+ PreparedStatement ps = null;
+ try {
+ ps = conn.prepareStatement(Sql);
+ for(int i = 0; i < rent_list.size(); i ++) {
+ ps.setString(1, UUIDUtil.getUUID());
+ ps.setString(2, tcb.getDocId());
+ ps.setString(3, tcb.getPlanCValue());
+ ps.setInt(4, startList);
+ ps.setString(5, planDate_list.get(i));
+ ps.setString(6, interestDateList.get(i));
+ ps.setString(7, "未回笼");
+ ps.setString(8, NumberUtils.nullToZero(rent_list.get(i)));
+ ps.setString(9, NumberUtils.nullToZero(corpus_list.get(i)));
+ ps.setString(10, NumberUtils.nullToZero(year_rate_list.get(i)));
+ ps.setString(11, NumberUtils.nullToZero(interest_list.get(i)));
+ ps.setString(12, NumberUtils.nullToZero(corpusOverage_list.get(i)));
+ ps.setString(13, fpb.getColumn_1().get(i));
+ ps.setString(14, fpb.getColumn_2().get(i));
+ ps.addBatch();
+ startList++;
+ }
+ ps.executeBatch();
+ } catch(Exception e) {
+ e.printStackTrace();
+ throw new BusinessException("insert rent_plan error");
+ } finally {
+ if(ps != null) ps.close();
+ }
+ /*BizObjectManager bm=JBOFactory.getBizObjectManager(tcb.getRentPlan_tb(), tx);
for (int i = 0; i < rent_list.size(); i++) {
BizObject rent=bm.newObject();
rent.setAttributeValue("flowunid",tcb.getDocId());
@@ -106,7 +147,7 @@ public abstract class FundRentPlanExecutor {
}
startList++;
bm.saveObject(rent);
- }
+ }*/
}
}
diff --git a/calc/com/tenwa/reckon/help/PlanDateServiceImpl.java b/calc/com/tenwa/reckon/help/PlanDateServiceImpl.java
index f27e9cb2b..61585554d 100644
--- a/calc/com/tenwa/reckon/help/PlanDateServiceImpl.java
+++ b/calc/com/tenwa/reckon/help/PlanDateServiceImpl.java
@@ -9,6 +9,7 @@ import java.util.List;
import jbo.com.tenwa.entity.comm.holiday.BT_HOLIDAY;
+import com.amarsoft.app.als.prd.config.loader.ProductConfig;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.BizObjectManager;
import com.amarsoft.are.jbo.JBOFactory;
@@ -114,7 +115,7 @@ public class PlanDateServiceImpl {
public String adjustDate(String date,String type) throws Exception{
- BizObject bo2=JBOFactory.createBizObjectQuery(BT_HOLIDAY.CLASS_NAME, "c_date='"+date+"'").getSingleResult(false);
+ /*BizObject bo2=JBOFactory.createBizObjectQuery(BT_HOLIDAY.CLASS_NAME, "c_date='"+date+"'").getSingleResult(false);
if(bo2==null){
Calendar cal = Calendar.getInstance();
@@ -127,6 +128,19 @@ public class PlanDateServiceImpl {
}
}else if("班".equals(bo2.getAttribute("otype").getString())){
return date;
+ }*/
+ String otype = ProductConfig.getHoliday(date);
+ if(otype==null){
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(dateFormat.parse(date));
+ if(cal.get(Calendar.DAY_OF_WEEK)==Calendar.SATURDAY||cal.get(Calendar.DAY_OF_WEEK)==Calendar.SUNDAY)
+ {
+
+ }else{
+ return date;
+ }
+ }else if("班".equals(otype)){
+ return date;
}
diff --git a/calc/com/tenwa/reckon/help/RentalServiceImpl.java b/calc/com/tenwa/reckon/help/RentalServiceImpl.java
index 1551c834b..e2e4e7bff 100644
--- a/calc/com/tenwa/reckon/help/RentalServiceImpl.java
+++ b/calc/com/tenwa/reckon/help/RentalServiceImpl.java
@@ -71,7 +71,12 @@ public class RentalServiceImpl {
if(cb.getRentOrRate() != null && cb.getRentOrRate().equals("rent")){
rent = cb.getRentValue().toString();
}else{
- rent =new BigDecimal(RentTools.getPMT(preRate, cb.getIncomeNumber() + "", cleanLeaseMoney, cb.getEquipEndValue(), cb.getPeriodType())).toString();
+ BigDecimal finalPayment = new BigDecimal(cb.getFinalPayment());
+ if(finalPayment.compareTo(BigDecimal.ZERO) != 0) {
+ rent = new BigDecimal(RentTools.getPMT(preRate, cb.getIncomeNumber() + "", cleanLeaseMoney, finalPayment.toString(), cb.getPeriodType())).toString();
+ } else {
+ rent = new BigDecimal(RentTools.getPMT(preRate, cb.getIncomeNumber() + "", cleanLeaseMoney, cb.getEquipEndValue(), cb.getPeriodType())).toString();
+ }
if(cb.getRentRound().length()>0){
rent=NumberUtils.rentRound(rent, cb.getRentRound(),cb.getRentRoundType());
}
@@ -192,8 +197,13 @@ public class RentalServiceImpl {
* @return
*/
public List getNormalRentList(ConditionBean cb, List rent_list, String rent) {
+ BigDecimal finalPayment = new BigDecimal(cb.getFinalPayment());
for (int i = 0; i < cb.getIncomeNumber(); i++) {
- rent_list.add(rent);
+ if(i == cb.getIncomeNumber() - 1 && finalPayment.compareTo(BigDecimal.ONE) != 0) {
+ rent_list.add(finalPayment.add(new BigDecimal(rent)).toString());
+ } else {
+ rent_list.add(rent);
+ }
}
return rent_list;
}
diff --git a/calc/com/tenwa/reckon/product/GenBodyDataImpCalc.java b/calc/com/tenwa/reckon/product/GenBodyDataImpCalc.java
index 9b2134e72..af1469d81 100644
--- a/calc/com/tenwa/reckon/product/GenBodyDataImpCalc.java
+++ b/calc/com/tenwa/reckon/product/GenBodyDataImpCalc.java
@@ -105,6 +105,17 @@ public class GenBodyDataImpCalc extends GenBodyData{
sInputHtml = getInputHtml(i,values.get(sColName) != null ? values.get(sColName).toString() : "");
else
sInputHtml = getInputHtml(i, "");
+
+ if(!"".equals(ratioValue)) {//利率字段调整为百分比
+ if(!isLast(i)) {
+ ratioValue = ratioValue.replaceAll("width:37px;", ";width:23%;");
+ sInputHtml = sInputHtml.replaceAll(";width:120px;", ";width:65%;");
+ } else {
+ ratioValue = ratioValue.replaceAll("width:37px;", ";width:35px;");
+ sInputHtml = sInputHtml.replaceAll(";width:120px;", ";width:100;");
+ }
+ }
+
if (iHorizonPosition == 0)
if (isLast(i))
iColspan = 2;
@@ -333,8 +344,8 @@ public class GenBodyDataImpCalc extends GenBodyData{
int iColName = MDataBuilder.getColumnsIndex2("colname");
int iDefaultValue = MDataBuilder.getColumnsIndex2("coldefaultvalue");
String sColName = m.getField(iColName).getValue();
- String value=values.get(sColName) != null ? values.get(sColName).toString():"";
- //if (value == null) value = "";
+ String value=values.get(sColName).toString();
+ if (value == null) value = "";
String sDefaultValue =m.getField(iDefaultValue).getValue();
if ((this.asObj.isNeedFillDefaultValue()) && (value.equals(""))) {
value = sDefaultValue;
diff --git a/calc/com/tenwa/reckon/product/ProductCondition.java b/calc/com/tenwa/reckon/product/ProductCondition.java
index 1b4ef5332..57108ba24 100644
--- a/calc/com/tenwa/reckon/product/ProductCondition.java
+++ b/calc/com/tenwa/reckon/product/ProductCondition.java
@@ -7,6 +7,7 @@ import java.util.Vector;
import jbo.sys.CODE_LIBRARY;
+import com.amarsoft.app.als.sys.tools.DateUtil;
import com.amarsoft.app.awe.config.InitDBType;
import com.amarsoft.app.util.ProductParamUtil;
import com.amarsoft.are.jbo.BizObject;
@@ -27,6 +28,7 @@ public class ProductCondition {
* @throws Exception
*/
public String getProductRules(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));//资金配置项
@@ -216,10 +218,6 @@ public class ProductCondition {
if(map.containsKey(col)){//产品配置了该费用项
rule=prodSer.getFeeRule(doTemp, map, col,colName,vali);
doTemp.setDefaultValue(col+"_FINA",fina);
- /*if("FINA".equals(isFina)){
- doTemp.setRequired(col, true);
- doTemp.setRequired(col+"_"+isFina, true);
- }*/
}else{
if("FINA".equals(isFina)){
doTemp.setVisible(col+"_"+isFina, false);
@@ -228,6 +226,12 @@ public class ProductCondition {
if(fee.getAttribute("itemno").getString().equals("feetype2")){
doTemp.setVisible("CAUTION_DEDUCTION_MONEY", false);
doTemp.setVisible("CAUTION_MONEY_REMAIN", false);
+ doTemp.setVisible("CAUTION_MONEY_METHOD", false);
+ doTemp.setRequired("CAUTION_MONEY_METHOD", false);
+ }
+ if("FINAL_PAYMENT".equals(col)) {
+ doTemp.setVisible(col + "_METHOD", false);
+ doTemp.setRequired(col + "_METHOD", false);
}
rule=null;
}
@@ -394,6 +398,15 @@ public class ProductCondition {
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");
@@ -431,34 +444,26 @@ public class ProductCondition {
}
//获取期数等
public void getCautionRatio(ASObjectModel doTemp,String productId) throws Exception{
- //首付款比例
- String CAR_FIRST_PAYMENT_RATIO = ProductParamUtil.getProductParameterValue(productId, "PRD0315","FIRST_PAYMENT","CostType09");
- doTemp.setDefaultValue("CAR_FIRST_PAYMENT_RATIO",CAR_FIRST_PAYMENT_RATIO);
- //保证金
- String caution_money = ProductParamUtil.getProductParameterValue(productId, "PRD0315","CAUTION_MONEY","CostType09");
- doTemp.setDefaultValue("CAUTION_MONEY_RATIO",caution_money);
- //手续费
- String handle_charge_money = ProductParamUtil.getProductParameterValue(productId, "PRD0315","HANDLING_CHARGE_MONEY","CostType09");
- doTemp.setDefaultValue("HANDLING_CHARGE_MONEY_RATIO",handle_charge_money);
-
- //期数
- String INCOME_NUMBER = ProductParamUtil.getProductParameterValue(productId, "PRD0350","product_rate","INCOME_NUMBER");
- doTemp.setDefaultValue("INCOME_NUMBER",INCOME_NUMBER);
- //期初/期末
- String period_type = ProductParamUtil.getProductParameterValue(productId, "PRD0315","period_type","begin_end");
- doTemp.setDefaultValue("PERIOD_TYPE",period_type);
-
//测算年利率字段
- String ProductType = ProductParamUtil.getProductParameterValue(productId, "PRD0350","product_rate","ProductType");
- String isReadOnly = ProductParamUtil.getProductParameterValue(productId, "PRD0350","product_rate","ProductRateReadOnly");
- String YEAR_RATE = ProductParamUtil.getProductParameterValue(productId, "PRD0350","product_rate","ProductRate");
- //利率为0,费率为1
- if("1".equals(ProductType)){
- doTemp.setColumnAttribute("YEAR_RATE","colheader","测算费率");
+ Map> productRates = ProductParamUtil.getProductComponentType(productId, "PRD0350");
+ Map productRate = productRates.get("product_rate");
+ if(productRate != null) {
+ String incomeNumber = productRate.get("INCOME_NUMBER") == null ? "0" : productRate.get("INCOME_NUMBER");
+ doTemp.setDefaultValue("INCOME_NUMBER",incomeNumber);
+ String periodType = productRate.get("begin_end") == null ? "period_type_0" : productRate.get("begin_end");
+ doTemp.setDefaultValue("PERIOD_TYPE",periodType);
+
+ String ProductType = productRate.get("ProductType") == null ? "0" : productRate.get("ProductType");
+ String isReadOnly = productRate.get("ProductRateReadOnly") == null ? "Y" : productRate.get("ProductRateReadOnly");
+ String YEAR_RATE = productRate.get("ProductRate") == null ? "0" : productRate.get("ProductRate");
+ //利率为0,费率为1
+ if("1".equals(ProductType)){
+ doTemp.setColumnAttribute("YEAR_RATE","colheader","测算费率");
+ }
+ if("Y".equals(isReadOnly)){
+ doTemp.setColumnAttribute("YEAR_RATE","colreadyonly","1");
+ }
+ doTemp.setDefaultValue("YEAR_RATE",YEAR_RATE);
}
- if("Y".equals(isReadOnly)){
- doTemp.setColumnAttribute("YEAR_RATE","colreadyonly","1");
- }
- doTemp.setDefaultValue("YEAR_RATE",YEAR_RATE);
}
}
diff --git a/calc/com/tenwa/reckon/product/ProductConditionService.java b/calc/com/tenwa/reckon/product/ProductConditionService.java
index c130513e7..491cee929 100644
--- a/calc/com/tenwa/reckon/product/ProductConditionService.java
+++ b/calc/com/tenwa/reckon/product/ProductConditionService.java
@@ -60,9 +60,15 @@ public class ProductConditionService {
if(col.equals("CAUTION_MONEY")){
doTemp.setColumnAttribute("CAUTION_DEDUCTION_MONEY","sortno",oder+doTemp.getColumnAttribute("CAUTION_DEDUCTION_MONEY", "sortno"));
doTemp.setColumnAttribute("CAUTION_MONEY_REMAIN","sortno",oder+doTemp.getColumnAttribute("CAUTION_MONEY_REMAIN", "sortno"));
+ doTemp.setColumnAttribute("CAUTION_MONEY_METHOD","sortno",oder+doTemp.getColumnAttribute("CAUTION_MONEY_METHOD", "sortno"));
}
}
+ String groupId = doTemp.getColumnAttribute(col, "groupid");
+ if("0070".equals(groupId)) {
+ rule.put("financing", "true");
+ }
+
String ratioMin=StringUtil.nullToString(map.get(col).get("CostType09-MIN"));//比例最小值
String ratioMax=StringUtil.nullToString(map.get(col).get("CostType09-MAX"));//比例最小值
String ratioDefaultValue=StringUtil.nullToString(map.get(col).get("CostType09"));//比例限定值