提交分段融

This commit is contained in:
zhulh 2021-07-27 15:15:21 +08:00
parent 6e43fe14e7
commit 4ccaa7ecf5
7 changed files with 712 additions and 205 deletions

View File

@ -445,7 +445,7 @@ CalcControl.InitStartDate=function(){
break;
}
//是按起租日计算的情况,直接读取当前日期
if(calcRules["method"][methodName]["DefaultDueDay"] != "02") {
if( calcRules["method"][methodName]["DefaultDueDay"] && calcRules["method"][methodName]["DefaultDueDay"] != "02") {
rentDay = calcRules["method"][methodName]["ActualDay"];
}
@ -1248,6 +1248,7 @@ function run()
setItemValue(0,getRow(),p.toUpperCase(),result.info[p]);
}
}
subsection_list.window.reloadSelf();
if(result.message){
alert(result.message);
}

View File

@ -1080,6 +1080,7 @@
<attribute name="SPLIT_TYPE" label="是否灵活分润" type="STRING"/>
<attribute name="PERSONAL_INSURANCE" label="个人意外险" type="DOUBLE" length="22" scale="2"/>
<attribute name="DISCOUNT_INTEREST" label="贴息" type="DOUBLE" length="22" scale="2"/>
<attribute name="SUBSECTION_CONDIG" label="分段配置" type="STRING" length="32"/>
</attributes>
<manager>
<managerProperties>
@ -1423,6 +1424,7 @@
<attribute name="SPLIT_TYPE" label="是否灵活分润" type="STRING"/>
<attribute name="PERSONAL_INSURANCE" label="个人意外险" type="DOUBLE" length="22" scale="2"/>
<attribute name="DISCOUNT_INTEREST" label="贴息" type="DOUBLE" length="22" scale="2"/>
<attribute name="SUBSECTION_CONDIG" label="分段配置" type="STRING" length="32"/>
</attributes>
<manager>
<managerProperties>
@ -2783,6 +2785,7 @@
<attribute name="SPLIT_TYPE" label="是否灵活分润" type="STRING"/>
<attribute name="PERSONAL_INSURANCE" label="个人意外险" type="DOUBLE" length="22" scale="2"/>
<attribute name="DISCOUNT_INTEREST" label="贴息" type="DOUBLE" length="22" scale="2"/>
<attribute name="SUBSECTION_CONDIG" label="分段配置" type="STRING" length="32"/>
</attributes>
<manager>
<managerProperties>
@ -3368,6 +3371,7 @@
<attribute name="SPLIT_TYPE" label="是否灵活分润" type="STRING"/>
<attribute name="PERSONAL_INSURANCE" label="个人意外险" type="DOUBLE" length="22" scale="2"/>
<attribute name="DISCOUNT_INTEREST" label="贴息" type="DOUBLE" length="22" scale="2"/>
<attribute name="SUBSECTION_CONDIG" label="分段配置" type="STRING" length="32"/>
</attributes>
<manager>
<managerProperties>
@ -4804,5 +4808,254 @@
</managerProperties>
</manager>
</class>
<class name="LC_CONTRACT_SUBSECTION_RENT_PLAN" label="" keyAttributes="ID">
<attributes>
<attribute name="ID" label="标识" type="STRING" length="32"/>
<attribute name="QUOT_ID" label="报价编号" type="STRING" length="32"/>
<attribute name="CUST_ID" label="客户编号" type="STRING" length="32"/>
<attribute name="PROJECT_ID" label="项目编号" type="STRING" length="32"/>
<attribute name="PROJECT_PLAN_NUMBER" label="项目方案编号" type="STRING" length="32"/>
<attribute name="CONTRACT_ID" label="合同编号" type="STRING" length="32"/>
<attribute name="CONTRACT_PLAN_NUMBER" label="合同方案编号" type="STRING" length="32"/>
<attribute name="PAYMENT_NUMBER" label="投放编号" type="STRING" length="32"/>
<attribute name="PLAN_LIST" label="期次" type="INT" length="10"/>
<attribute name="PLAN_DATE" label="计划日期" type="STRING" length="32"/>
<attribute name="PLAN_STATUS" label="收付状态" type="STRING" length="32"/>
<attribute name="RENT" label="租金" type="DOUBLE" length="18" scale="2"/>
<attribute name="CORPUS" label="财务本金" type="DOUBLE" length="18" scale="2"/>
<attribute name="INTEREST" label="财务租息" type="DOUBLE" length="18" scale="2"/>
<attribute name="PENALTY" label="应收罚息" type="DOUBLE" length="18" scale="2"/>
<attribute name="CORPUS_BUSINESS" label="业务本金" type="DOUBLE" length="18" scale="2"/>
<attribute name="INTEREST_BUSINESS" label="业务租息" type="DOUBLE" length="18" scale="2"/>
<attribute name="RENT_ADJUST" label="租金调整值" type="DOUBLE" length="18" scale="2"/>
<attribute name="ALL_REMAIN_CORPUS" label="本期后本金余额" type="DOUBLE" length="18" scale="2"/>
<attribute name="SETTLE_METHOD" label="结算方式" type="STRING" length="32"/>
<attribute name="COIN" label="币种" type="STRING" length="32"/>
<attribute name="YEAR_RATE" label="年利率" type="DOUBLE" length="18" scale="6"/>
<attribute name="MEMO" label="备注" type="STRING" length="100"/>
<attribute name="FLOWUNID" label="流程编号" type="STRING" length="32"/>
<attribute name="INPUTUSERID" label="登记人" type="STRING" length="32"/>
<attribute name="INPUTORGID" label="登记部门" type="STRING" length="32"/>
<attribute name="INPUTTIME" label="登记时间" type="STRING" length="32"/>
<attribute name="UPDATEUSERID" label="更新人" type="STRING" length="32"/>
<attribute name="UPDATEORGID" label="更新部门" type="STRING" length="32"/>
<attribute name="UPDATETIME" label="更新时间" type="STRING" length="32"/>
<attribute name="INTEREST_DATE" label="计息日" type="STRING" length="32"/>
<attribute name="subsection_number" label="subsection_number" type="INT" length="10"/>
</attributes>
<manager>
<managerProperties>
<property name="table" value="lc_contract_subsection_rent_plan" />
<property name="createKey" value="true" />
</managerProperties>
</manager>
</class>
<class name="LC_PROJ_SUBSECTION_RENT_PLAN" label="" keyAttributes="ID">
<attributes>
<attribute name="ID" label="标识" type="STRING" length="32"/>
<attribute name="QUOT_ID" label="报价编号" type="STRING" length="32"/>
<attribute name="CUST_ID" label="客户编号" type="STRING" length="32"/>
<attribute name="PROJECT_ID" label="项目编号" type="STRING" length="32"/>
<attribute name="PROJECT_PLAN_NUMBER" label="项目方案编号" type="STRING" length="32"/>
<attribute name="CONTRACT_ID" label="合同编号" type="STRING" length="32"/>
<attribute name="CONTRACT_PLAN_NUMBER" label="合同方案编号" type="STRING" length="32"/>
<attribute name="PAYMENT_NUMBER" label="投放编号" type="STRING" length="32"/>
<attribute name="PLAN_LIST" label="期次" type="INT" length="10"/>
<attribute name="PLAN_DATE" label="计划日期" type="STRING" length="32"/>
<attribute name="PLAN_STATUS" label="收付状态" type="STRING" length="32"/>
<attribute name="RENT" label="租金" type="DOUBLE" length="18" scale="2"/>
<attribute name="CORPUS" label="财务本金" type="DOUBLE" length="18" scale="2"/>
<attribute name="INTEREST" label="财务租息" type="DOUBLE" length="18" scale="2"/>
<attribute name="PENALTY" label="应收罚息" type="DOUBLE" length="18" scale="2"/>
<attribute name="CORPUS_BUSINESS" label="业务本金" type="DOUBLE" length="18" scale="2"/>
<attribute name="INTEREST_BUSINESS" label="业务租息" type="DOUBLE" length="18" scale="2"/>
<attribute name="RENT_ADJUST" label="租金调整值" type="DOUBLE" length="18" scale="2"/>
<attribute name="ALL_REMAIN_CORPUS" label="本期后本金余额" type="DOUBLE" length="18" scale="2"/>
<attribute name="SETTLE_METHOD" label="结算方式" type="STRING" length="32"/>
<attribute name="COIN" label="币种" type="STRING" length="32"/>
<attribute name="YEAR_RATE" label="年利率" type="DOUBLE" length="18" scale="6"/>
<attribute name="MEMO" label="备注" type="STRING" length="100"/>
<attribute name="FLOWUNID" label="流程编号" type="STRING" length="32"/>
<attribute name="INPUTUSERID" label="登记人" type="STRING" length="32"/>
<attribute name="INPUTORGID" label="登记部门" type="STRING" length="32"/>
<attribute name="INPUTTIME" label="登记时间" type="STRING" length="32"/>
<attribute name="UPDATEUSERID" label="更新人" type="STRING" length="32"/>
<attribute name="UPDATEORGID" label="更新部门" type="STRING" length="32"/>
<attribute name="UPDATETIME" label="更新时间" type="STRING" length="32"/>
<attribute name="INTEREST_DATE" label="计息日" type="STRING" length="32"/>
<attribute name="subsection_number" label="subsection_number" type="INT" length="10"/>
</attributes>
<manager>
<managerProperties>
<property name="table" value="lc_proj_subsection_rent_plan" />
<property name="createKey" value="true" />
</managerProperties>
</manager>
</class>
<class name="LC_SUBSECTION_RENT_PLAN" label="" keyAttributes="ID">
<attributes>
<attribute name="ID" label="标识" type="STRING" length="32"/>
<attribute name="QUOT_ID" label="报价编号" type="STRING" length="32"/>
<attribute name="CUST_ID" label="客户编号" type="STRING" length="32"/>
<attribute name="PROJECT_ID" label="项目编号" type="STRING" length="32"/>
<attribute name="PROJECT_PLAN_NUMBER" label="项目方案编号" type="STRING" length="32"/>
<attribute name="CONTRACT_ID" label="合同编号" type="STRING" length="32"/>
<attribute name="CONTRACT_PLAN_NUMBER" label="合同方案编号" type="STRING" length="32"/>
<attribute name="PAYMENT_NUMBER" label="投放编号" type="STRING" length="32"/>
<attribute name="PLAN_LIST" label="期次" type="INT" length="10"/>
<attribute name="PLAN_DATE" label="计划日期" type="STRING" length="32"/>
<attribute name="PLAN_STATUS" label="收付状态" type="STRING" length="32"/>
<attribute name="RENT" label="租金" type="DOUBLE" length="18" scale="2"/>
<attribute name="CORPUS" label="财务本金" type="DOUBLE" length="18" scale="2"/>
<attribute name="INTEREST" label="财务租息" type="DOUBLE" length="18" scale="2"/>
<attribute name="PENALTY" label="应收罚息" type="DOUBLE" length="18" scale="2"/>
<attribute name="CORPUS_BUSINESS" label="业务本金" type="DOUBLE" length="18" scale="2"/>
<attribute name="INTEREST_BUSINESS" label="业务租息" type="DOUBLE" length="18" scale="2"/>
<attribute name="RENT_ADJUST" label="租金调整值" type="DOUBLE" length="18" scale="2"/>
<attribute name="ALL_REMAIN_CORPUS" label="本期后本金余额" type="DOUBLE" length="18" scale="2"/>
<attribute name="SETTLE_METHOD" label="结算方式" type="STRING" length="32"/>
<attribute name="COIN" label="币种" type="STRING" length="32"/>
<attribute name="YEAR_RATE" label="年利率" type="DOUBLE" length="18" scale="6"/>
<attribute name="MEMO" label="备注" type="STRING" length="100"/>
<attribute name="FLOWUNID" label="流程编号" type="STRING" length="32"/>
<attribute name="INPUTUSERID" label="登记人" type="STRING" length="32"/>
<attribute name="INPUTORGID" label="登记部门" type="STRING" length="32"/>
<attribute name="INPUTTIME" label="登记时间" type="STRING" length="32"/>
<attribute name="UPDATEUSERID" label="更新人" type="STRING" length="32"/>
<attribute name="UPDATEORGID" label="更新部门" type="STRING" length="32"/>
<attribute name="UPDATETIME" label="更新时间" type="STRING" length="32"/>
<attribute name="INTEREST_DATE" label="计息日" type="STRING" length="32"/>
<attribute name="AUDIT_STATE" label="代收审计状态" type="STRING" length="32"/>
<attribute name="COLLECT_STATUS" label="收款状态" type="STRING" length="32"/>
<attribute name="COLLECT_MSG" label="收款描述" type="STRING" length="200"/>
<attribute name="FAILURE_TIME" label="失败时间" type="STRING" length="200"/>
<attribute name="FAILURE_REASON" label="失败原因" type="STRING" length="200"/>
<attribute name="BATCH_NO" label="批量交易流水号,若拆分,以,分割" type="STRING" length="200"/>
<attribute name="BATCH_STATUS" label="批量处理状态" type="STRING" length="200"/>
<attribute name="batch_sn" label="batch_sn" type="STRING" length="200"/>
<attribute name="SPARE_BATCH_NO" label="SPARE_BATCH_NO" type="STRING" length="32"/>
<attribute name="CORPUS_SP" label="CORPUS_SP" type="DOUBLE" length="18" scale="2"/>
<attribute name="INTEREST_sp" label="INTEREST_sp" type="DOUBLE" length="18" scale="2"/>
<attribute name="splitting_status" label="splitting_status" type="STRING" length="2"/>
<attribute name="charge_way" label="charge_way" type="STRING" length="10"/>
<attribute name="subsection_number" label="subsection_number" type="INT" length="10"/>
</attributes>
<manager>
<managerProperties>
<property name="table" value="lc_subsection_rent_plan" />
<property name="createKey" value="true" />
</managerProperties>
</manager>
</class>
<class name="LC_SUBSECTION_RENT_PLAN_HIS" label="" keyAttributes="ID">
<attributes>
<attribute name="ID" label="标识" type="STRING" length="32"/>
<attribute name="QUOT_ID" label="报价编号" type="STRING" length="32"/>
<attribute name="CUST_ID" label="客户编号" type="STRING" length="32"/>
<attribute name="PROJECT_ID" label="项目编号" type="STRING" length="32"/>
<attribute name="PROJECT_PLAN_NUMBER" label="项目方案编号" type="STRING" length="32"/>
<attribute name="CONTRACT_ID" label="合同编号" type="STRING" length="32"/>
<attribute name="CONTRACT_PLAN_NUMBER" label="合同方案编号" type="STRING" length="32"/>
<attribute name="PAYMENT_NUMBER" label="投放编号" type="STRING" length="32"/>
<attribute name="PLAN_LIST" label="期次" type="INT" length="10"/>
<attribute name="PLAN_DATE" label="计划日期" type="STRING" length="32"/>
<attribute name="PLAN_STATUS" label="收付状态" type="STRING" length="32"/>
<attribute name="RENT" label="租金" type="DOUBLE" length="18" scale="2"/>
<attribute name="CORPUS" label="财务本金" type="DOUBLE" length="18" scale="2"/>
<attribute name="INTEREST" label="财务租息" type="DOUBLE" length="18" scale="2"/>
<attribute name="PENALTY" label="应收罚息" type="DOUBLE" length="18" scale="2"/>
<attribute name="CORPUS_BUSINESS" label="业务本金" type="DOUBLE" length="18" scale="2"/>
<attribute name="INTEREST_BUSINESS" label="业务租息" type="DOUBLE" length="18" scale="2"/>
<attribute name="RENT_ADJUST" label="租金调整值" type="DOUBLE" length="18" scale="2"/>
<attribute name="ALL_REMAIN_CORPUS" label="本期后本金余额" type="DOUBLE" length="18" scale="2"/>
<attribute name="SETTLE_METHOD" label="结算方式" type="STRING" length="32"/>
<attribute name="COIN" label="币种" type="STRING" length="32"/>
<attribute name="YEAR_RATE" label="年利率" type="DOUBLE" length="18" scale="6"/>
<attribute name="MEMO" label="备注" type="STRING" length="100"/>
<attribute name="FLOWUNID" label="流程编号" type="STRING" length="32"/>
<attribute name="INPUTUSERID" label="登记人" type="STRING" length="32"/>
<attribute name="INPUTORGID" label="登记部门" type="STRING" length="32"/>
<attribute name="INPUTTIME" label="登记时间" type="STRING" length="32"/>
<attribute name="UPDATEUSERID" label="更新人" type="STRING" length="32"/>
<attribute name="UPDATEORGID" label="更新部门" type="STRING" length="32"/>
<attribute name="UPDATETIME" label="更新时间" type="STRING" length="32"/>
<attribute name="INTEREST_DATE" label="计息日" type="STRING" length="32"/>
<attribute name="AUDIT_STATE" label="代收审计状态" type="STRING" length="32"/>
<attribute name="COLLECT_STATUS" label="收款状态" type="STRING" length="32"/>
<attribute name="COLLECT_MSG" label="收款描述" type="STRING" length="200"/>
<attribute name="FAILURE_TIME" label="失败时间" type="STRING" length="200"/>
<attribute name="FAILURE_REASON" label="失败原因" type="STRING" length="200"/>
<attribute name="BATCH_NO" label="批量交易流水号,若拆分,以,分割" type="STRING" length="200"/>
<attribute name="BATCH_STATUS" label="批量处理状态" type="STRING" length="200"/>
<attribute name="BATCH_SN" label="一笔批量交易流水内项数SN" type="STRING" length="200"/>
<attribute name="SPARE_BATCH_NO" label="SPARE_BATCH_NO" type="STRING" length="32"/>
<attribute name="CORPUS_SP" label="CORPUS_SP" type="DOUBLE" length="18" scale="2"/>
<attribute name="INTEREST_sp" label="INTEREST_sp" type="DOUBLE" length="18" scale="2"/>
<attribute name="splitting_status" label="splitting_status" type="STRING" length="2"/>
<attribute name="charge_way" label="charge_way" type="STRING" length="10"/>
<attribute name="subsection_number" label="subsection_number" type="INT" length="10"/>
</attributes>
<manager>
<managerProperties>
<property name="table" value="lc_subsection_rent_plan_his" />
<property name="createKey" value="true" />
</managerProperties>
</manager>
</class>
<class name="LC_SUBSECTION_RENT_PLAN_TEMP" label="" keyAttributes="ID">
<attributes>
<attribute name="ID" label="标识" type="STRING" length="32"/>
<attribute name="QUOT_ID" label="报价编号" type="STRING" length="32"/>
<attribute name="CUST_ID" label="客户编号" type="STRING" length="32"/>
<attribute name="PROJECT_ID" label="项目编号" type="STRING" length="32"/>
<attribute name="PROJECT_PLAN_NUMBER" label="项目方案编号" type="STRING" length="32"/>
<attribute name="CONTRACT_ID" label="合同编号" type="STRING" length="32"/>
<attribute name="CONTRACT_PLAN_NUMBER" label="合同方案编号" type="STRING" length="32"/>
<attribute name="PAYMENT_NUMBER" label="投放编号" type="STRING" length="32"/>
<attribute name="PLAN_LIST" label="期次" type="INT" length="10"/>
<attribute name="PLAN_DATE" label="计划日期" type="STRING" length="32"/>
<attribute name="PLAN_STATUS" label="收付状态" type="STRING" length="32"/>
<attribute name="RENT" label="租金" type="DOUBLE" length="18" scale="2"/>
<attribute name="CORPUS" label="财务本金" type="DOUBLE" length="18" scale="2"/>
<attribute name="INTEREST" label="财务租息" type="DOUBLE" length="18" scale="2"/>
<attribute name="PENALTY" label="应收罚息" type="DOUBLE" length="18" scale="2"/>
<attribute name="CORPUS_BUSINESS" label="业务本金" type="DOUBLE" length="18" scale="2"/>
<attribute name="INTEREST_BUSINESS" label="业务租息" type="DOUBLE" length="18" scale="2"/>
<attribute name="RENT_ADJUST" label="租金调整值" type="DOUBLE" length="18" scale="2"/>
<attribute name="ALL_REMAIN_CORPUS" label="本期后本金余额" type="DOUBLE" length="18" scale="2"/>
<attribute name="SETTLE_METHOD" label="结算方式" type="STRING" length="32"/>
<attribute name="COIN" label="币种" type="STRING" length="32"/>
<attribute name="YEAR_RATE" label="年利率" type="DOUBLE" length="18" scale="6"/>
<attribute name="MEMO" label="备注" type="STRING" length="100"/>
<attribute name="FLOWUNID" label="流程编号" type="STRING" length="32"/>
<attribute name="INPUTUSERID" label="登记人" type="STRING" length="32"/>
<attribute name="INPUTORGID" label="登记部门" type="STRING" length="32"/>
<attribute name="INPUTTIME" label="登记时间" type="STRING" length="32"/>
<attribute name="UPDATEUSERID" label="更新人" type="STRING" length="32"/>
<attribute name="UPDATEORGID" label="更新部门" type="STRING" length="32"/>
<attribute name="UPDATETIME" label="更新时间" type="STRING" length="32"/>
<attribute name="INTEREST_DATE" label="计息日" type="STRING" length="32"/>
<attribute name="AUDIT_STATE" label="代收审计状态" type="STRING" length="32"/>
<attribute name="COLLECT_STATUS" label="收款状态" type="STRING" length="32"/>
<attribute name="COLLECT_MSG" label="收款描述" type="STRING" length="200"/>
<attribute name="FAILURE_TIME" label="失败时间" type="STRING" length="200"/>
<attribute name="FAILURE_REASON" label="失败原因" type="STRING" length="200"/>
<attribute name="BATCH_NO" label="交易流水号,若拆分,以,分割" type="STRING" length="200"/>
<attribute name="BATCH_STATUS" label="批量处理状态" type="STRING" length="200"/>
<attribute name="BATCH_SN" label="一笔批量交易流水内项数SN" type="STRING" length="200"/>
<attribute name="SPARE_BATCH_NO" label="SPARE_BATCH_NO" type="STRING" length="32"/>
<attribute name="CORPUS_SP" label="CORPUS_SP" type="DOUBLE" length="18" scale="2"/>
<attribute name="INTEREST_sp" label="INTEREST_sp" type="DOUBLE" length="18" scale="2"/>
<attribute name="splitting_status" label="splitting_status" type="STRING" length="2"/>
<attribute name="charge_way" label="charge_way" type="STRING" length="10"/>
<attribute name="subsection_number" label="subsection_number" type="INT" length="10"/>
</attributes>
<manager>
<managerProperties>
<property name="table" value="lc_subsection_rent_plan_temp" />
<property name="createKey" value="true" />
</managerProperties>
</manager>
</class>
</package>
</jbo>

View File

@ -710,6 +710,8 @@ public class CreateTransactionExecutor implements Transaction {
executor=new CarEvenInterestExecutor(tx,bean.getProductId());//³µ´û¾ùÏ¢Èë¿Ú
}else if(settleMethod.equals("car_even_rent")){
executor=new CarEvenRentExecutor(tx,bean.getProductId());//³µ´ûµÈ×âÈë¿Ú
} else if ( "segmented_financing".equals( settleMethod ) ) {
executor = new SegmentedFinancingExecutor( tx );
} else {
executor = new EvenRentExecutor(tx);
}

View File

@ -29,7 +29,7 @@ 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<FundPlanBean> fundPlanBeans=new ArrayList<FundPlanBean>();
@ -43,6 +43,36 @@ public class FundFundPlanExecutor {
cb.setDeductionLastPlanDate(cb.getLastPlanDate());//不生成保证金抵扣及退还计划
}
fundPlanBeans = this.create(tcb,fundPlanBeans,tx);
// 补上分段融贴息计划
if ( "segmented_financing".equals( cb.getSettleMethod() ) ) {
BizObjectManager bom = JBOFactory.getBizObjectManager( "jbo.app.tenwa.calc.LC_CALC_SUBSECTION_INFO_TEMP", tx );
List<BizObject> bos = bom.createQuery( "flowunid = :flowunid" ).setParameter( "flowunid", tcb.getDocId() ).getResultList( false );
for ( BizObject bo : bos ) {
String discount = bo.getAttribute( "DISCOUNT" ).getString();
String subsectionNumber = bo.getAttribute( "SUBSECTION_NUMBER" ).getString();
String isBalanceLending = bo.getAttribute( "IS_BALANCE_LENDING" ).getString();
String discountCollectionPeriod = bo.getAttribute( "DISCOUNT_COLLECTION_PERIOD" ).getString();
FundPlanBean fundPlanBean = new FundPlanBean();
fundPlanBean.setFeeType( "feetype27" );
fundPlanBean.setPlanList( subsectionNumber );
fundPlanBean.setSettleMethod( "payfund6" );
fundPlanBean.setPayType( "pay_type_in" );
if ( "Y".equals( isBalanceLending ) ) {
fundPlanBean.setPlanDate( getPlanDate( "PaymentTime1", cb ) );
} else {
if ( "0".equals( discountCollectionPeriod ) ) {
fundPlanBean.setPlanDate( getPlanDate( "PaymentTime1", cb ) );
} else {
fundPlanBean.setPlanDate( rentPlan.getPlanDateList().get( Integer.parseInt( discountCollectionPeriod ) - 1 ) );
}
}
fundPlanBean.setPlanMoney( discount );
fundPlanBean.setPayCust( "" );
fundPlanBeans.add( fundPlanBean );
}
}
this.delete(tcb,tx);
this.add(fundPlanBeans, tcb,tx);
}
@ -110,7 +140,7 @@ public class FundFundPlanExecutor {
if(Float.parseFloat(sdhandlingCharge)>0){
ffcp=new FundPlanBean();
ffcp.setId(UUID.randomUUID().toString().replaceAll("-", ""));
ffcp.setFeeType("feetype30");//商定违约金
ffcp.setFeeType("feetype30");//商定违约金
ffcp.setPlanList("1");
ffcp.setSettleMethod("payfund6");
ffcp.setPayType("pay_type_in");
@ -136,7 +166,7 @@ public class FundFundPlanExecutor {
if(Float.parseFloat(otherIn)>0){
ffcp=new FundPlanBean();
ffcp.setId(UUID.randomUUID().toString().replaceAll("-", ""));
ffcp.setFeeType("feetype8");//其他应收
ffcp.setFeeType("feetype8");//其他应收
ffcp.setPlanList("1");
ffcp.setSettleMethod("payfund6");
ffcp.setPayType("pay_type_in");
@ -147,7 +177,7 @@ public class FundFundPlanExecutor {
}
return fundPlanBeans;
}
//创建资金计划
private List<FundPlanBean> create(TabCalBean tcb,List<FundPlanBean> fundPlanBeans,JBOTransaction tx) throws Exception{
//获取产品租赁物类型配置
@ -167,7 +197,7 @@ public class FundFundPlanExecutor {
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);
@ -175,10 +205,10 @@ public class FundFundPlanExecutor {
custid=list.get(0).get("customer_id");
}
}
BizObject con=tcb.getCondition();
ConditionBean cb=tcb.getCb();
//String sql="select itemno from O where codeno='FeeType' and relativecode=:code";
Item[] items = CodeCache.getItems("FeeType");
for(Map.Entry<String,Map<String,String>> entry:map.entrySet()){
@ -192,11 +222,11 @@ public class FundFundPlanExecutor {
&& "EQUIP_END_VALUE".equals(key)) {
continue;
}
//取值
BigDecimal temp = null;
if("business_product".equals(tcb.getProductType())
if("business_product".equals(tcb.getProductType())
&& "CLEAN_LEASE_MONEY".equals(key)) {
temp = new BigDecimal(con.getAttribute("EQUIP_AMT").getDouble());
} else if("UNITE_MONEY_OUT".equals(key)){
@ -204,7 +234,7 @@ public class FundFundPlanExecutor {
}else{
temp = new BigDecimal(con.getAttribute(key).getDouble());
}
Item item = null;
for(Item it : items) {
if(key.equals(it.getRelativeCode())) {
@ -212,7 +242,7 @@ public class FundFundPlanExecutor {
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();
@ -224,7 +254,7 @@ public class FundFundPlanExecutor {
ffcp.setId(boLFP.getAttribute("id").getString());
bomLFP.deleteObject(boLFP);
}
}
ffcp.setFeeType(item.getItemNo());//费用类型
ffcp.setPlanList("1");
@ -283,7 +313,7 @@ public class FundFundPlanExecutor {
BizObjectManager bm=JBOFactory.getBizObjectManager(tcb.getFundFundPlan_tb(), tx);
bm.createQuery(sql).executeUpdate();
}
//保存资金计划到表
private void add(List<FundPlanBean> fp,TabCalBean tcb,JBOTransaction tx) throws Exception{
com.amarsoft.awe.util.Transaction tran = com.amarsoft.awe.util.Transaction.createTransaction(tx);
@ -341,17 +371,17 @@ public class FundFundPlanExecutor {
fundPlan.setAttributeValue("PAY_OBJ", fund.getPayObj());
fundPlan.setAttributeValue("SETTLE_METHOD",fund.getSettleMethod());
fundPlan.setAttributeValue("PAY_TYPE", fund.getPayType());
//联合方出资比例
//BigDecimal unionRatio=new BigDecimal(tcb.getCb().getUnioRatio());
//fundPlan.setAttributeValue("plan_money_union",new BigDecimal(fundPlan.getAttribute("PLAN_MONEY").getString()).multiply(unionRatio).divide(new BigDecimal(100), 2,BigDecimal.ROUND_HALF_UP).toString());
//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);
}*/
}
//生成抵扣保证金 保证金退还 资金计划
//生成抵扣保证金 保证金退还 资金计划
private static List<FundPlanBean> splitFundFundPlan(FundRentPlanBean planBean,ConditionBean cb,String custID,String remainType,String reduceType) throws Exception{
List<String> planDates = planBean.getPlanDateList();
List<String> rentPlans = planBean.getRentList();
@ -410,8 +440,8 @@ public class FundFundPlanExecutor {
}
return newFundPlans;
}
//生成抵扣保证金 保证金退还 资金计划
//生成抵扣保证金 保证金退还 资金计划
private static List<FundPlanBean> splitFundFundPlanList(FundRentPlanBean planBean,ConditionBean cb,String custID,String remainType,String reduceType) throws Exception{
List<String> planDates = planBean.getPlanDateList();
List<String> rentPlans = planBean.getRentList();

View File

@ -0,0 +1,209 @@
package com.tenwa.reckon.executor;
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.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.util.IrrTools;
import com.tenwa.reckon.util.RentTools;
import org.apache.commons.lang3.StringUtils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
public class SegmentedFinancingExecutor extends FundRentPlanExecutor {
public SegmentedFinancingExecutor(JBOTransaction tx) {
super( tx );
}
@Override
public FundRentPlanBean create( TabCalBean tcb, Integer startList ) throws Exception {
this.deleteRentPlan( tcb.getRentPlan_tb(), tcb, startList );
// 쾨뻘운늴鑒
String flowunid = tcb.getDocId();
BigDecimal incomeNumberYear = new BigDecimal( tcb.getCb().getIncomeNumberYear() );
BizObjectManager bom = JBOFactory.getBizObjectManager( "jbo.app.tenwa.calc.LC_CALC_SUBSECTION_INFO_TEMP", tx );
BizObjectManager bomLSRPT = JBOFactory.getBizObjectManager( "jbo.app.tenwa.calc.LC_SUBSECTION_RENT_PLAN_TEMP", tx );
bomLSRPT.createQuery( "delete from O where flowunid = :flowunid" ).setParameter( "flowunid", flowunid ).executeUpdate();
// 깁저롸뙈휨깊
List<BizObject> bos = bom.createQuery( "flowunid = :flowunid order by subsection_number" ).setParameter( "flowunid", flowunid )
.getResultList( true );
List<String> dates = new ArrayList<>();
List<String> interests = new ArrayList<>();
List<String> corpuss = new ArrayList<>();
List<String> rents = new ArrayList<>();
List<String> overCorpuss = new ArrayList<>();
PlanDateServiceImpl pdsi = new PlanDateServiceImpl( tx );
ConditionBean cb = tcb.getCb();
for ( BizObject bo : bos ) {
// 롸뙈뵀
String subsectionNumber = bo.getAttribute( "SUBSECTION_NUMBER" ).getString();
// 휨栗쏜띨
BigDecimal cleanLeaseMoney = new BigDecimal( bo.getAttribute( "CLEAN_LEASE_MONEY" ).getString() );
// 깃硫적쪽
BigDecimal rate = new BigDecimal( bo.getAttribute( "RATE" ).getString() ).divide( new BigDecimal( 100 ), 20, 4 );
// 퍅적쪽
BigDecimal preRate = rate.divide( incomeNumberYear, 20, 4 );
// 퍅늴
BigDecimal incomeNumber = new BigDecimal( bo.getAttribute( "INCOME_NUMBER" ).getString() );
cb.setIncomeNumber( incomeNumber.intValue() );
List<String> planDateList = pdsi.getPlanDateList( cb, null );
if ( planDateList.size() > dates.size() ) {
dates = planDateList;
}
// 季口셕炬렘駕
String discountCalcMethod = bo.getAttribute( "DISCOUNT_CALC_METHOD" ).getString();
// 휨栗적쪽
BigDecimal financingRate;
if ( "1".equals( discountCalcMethod ) ) { // 몽앴적쪽셕炬季口쏜띨
// 季口빈적쪽
BigDecimal discountRate = new BigDecimal( bo.getAttribute( "DISCOUNT_RATE" ).getString() ).divide( new BigDecimal( 100 ), 20, 4 );
// 퍅적쪽
BigDecimal preDiscountRate = discountRate.divide( incomeNumberYear, 20, 4 );
// 깃硫적쪽셕炬理쏜
String rent = RentTools.getPMT( preRate.toString(), incomeNumber.toString(), cleanLeaseMoney.negate().toString(), "0", "0" );
// 季口빈적쪽셕炬理쏜
String afterDiscountRent = RentTools.getPMT( preDiscountRate.toString(), incomeNumber.toString(), cleanLeaseMoney.negate().toString(), "0", "0" );
// 셕炬季口
BigDecimal discount = new BigDecimal( rent ).setScale( 2, 4 ).multiply( incomeNumber ).subtract( new BigDecimal( afterDiscountRent ).setScale( 2, 4 ).multiply( incomeNumber ) );
bo.setAttributeValue( "DISCOUNT", discount );
String fr = bo.getAttribute( "FINANCING_RATE" ).getString();
if ( StringUtils.isEmpty( fr ) ) {
financingRate = discountRate.divide( new BigDecimal( 100 ), 20, 4 );
bo.setAttributeValue( "FINANCING_RATE", discountRate.toString() );
} else {
financingRate = new BigDecimal( fr ).divide( new BigDecimal( 100 ), 20, 4 );
}
bo.setAttributeValue( tcb.getPlanCName(), tcb.getPlanCValue() );
bom.saveObject( bo );
} else {
// 季口쏜띨
BigDecimal discount = new BigDecimal( bo.getAttribute( "DISCOUNT" ).getString() );
// 깃硫적쪽셕炬理쏜
String rent = RentTools.getPMT( preRate.toString(), incomeNumber.toString(), cleanLeaseMoney.negate().toString(), "0", "0" );
// 季口빈理쏜
BigDecimal afterDiscountRent = new BigDecimal( rent ).setScale( 2, 4 ).multiply( incomeNumber ).subtract( discount ).divide( incomeNumber, 2, 4 );
List<BigDecimal> cashFlow = new ArrayList<>();
cashFlow.add( cleanLeaseMoney.negate() );
for ( int i = 0; i < incomeNumber.intValue(); i ++ ) {
cashFlow.add( afterDiscountRent );
}
BigDecimal discountRate = getIRR( cashFlow, incomeNumberYear ).setScale( 6, 4 );
bo.setAttributeValue( "DISCOUNT_RATE", discountRate.toString() );
String fr = bo.getAttribute( "FINANCING_RATE" ).getString();
if ( StringUtils.isEmpty( fr ) ) {
financingRate = discountRate.divide( new BigDecimal( 100 ), 20, 4 );
bo.setAttributeValue( "FINANCING_RATE", discountRate.toString() );
} else {
financingRate = new BigDecimal( fr ).divide( new BigDecimal( 100 ), 20, 4 );
}
bo.setAttributeValue( tcb.getPlanCName(), tcb.getPlanCValue() );
bom.saveObject( bo );
}
// 휨栗퍅적쪽
BigDecimal preFinancingRate = financingRate.divide( incomeNumberYear, 20, 4 );
// 茄셥理쏜
String rent = RentTools.getPMT( preFinancingRate.toString(), incomeNumber.toString(), cleanLeaseMoney.negate().toString(), "0", "0" );
BigDecimal r = new BigDecimal( rent ).setScale( 2, 4 );
for ( int i = 0; i < incomeNumber.intValue(); i ++ ) {
BigDecimal interest;
BigDecimal corpus;
if ( i == incomeNumber.intValue() - 1 ) {
corpus = cleanLeaseMoney;
if ( corpus.compareTo( r ) >= 0 ) {
r = corpus;
interest = BigDecimal.ZERO;
} else {
interest = r.subtract( corpus );
}
cleanLeaseMoney = BigDecimal.ZERO;
} else {
interest = cleanLeaseMoney.multiply( preFinancingRate ).setScale( 2, 4 );
corpus = r.subtract( interest );
cleanLeaseMoney = cleanLeaseMoney.subtract( corpus );
}
BizObject boLSRPT = bomLSRPT.newObject();
boLSRPT.setAttributeValue( "FLOWUNID", flowunid );
boLSRPT.setAttributeValue( tcb.getPlanCName(), tcb.getPlanCValue() );
boLSRPT.setAttributeValue( "PLAN_LIST", i + 1 );
boLSRPT.setAttributeValue( "PLAN_DATE", planDateList.get( i ) );
boLSRPT.setAttributeValue( "INTEREST_DATE", planDateList.get( i ) );
boLSRPT.setAttributeValue( "PLAN_STATUS", "灌쀼집" );
boLSRPT.setAttributeValue( "RENT", r.toString() );
boLSRPT.setAttributeValue( "CORPUS", corpus.toString() );
boLSRPT.setAttributeValue( "INTEREST", interest.toString() );
boLSRPT.setAttributeValue( "ALL_REMAIN_CORPUS", cleanLeaseMoney.toString() );
boLSRPT.setAttributeValue( "CORPUS_BUSINESS", corpus.toString() );
boLSRPT.setAttributeValue( "INTEREST_BUSINESS", interest.toString() );
boLSRPT.setAttributeValue( "SUBSECTION_NUMBER", subsectionNumber );
bomLSRPT.saveObject( boLSRPT );
if ( interests.size() - 1 > i ) {
interests.set( i, new BigDecimal( interests.get( i ) ).add( interest ).toString() );
corpuss.set( i, new BigDecimal( corpuss.get( i ) ).add( corpus ).toString() );
overCorpuss.set( i, new BigDecimal( overCorpuss.get( i ) ).add( cleanLeaseMoney ).toString() );
rents.set( i, new BigDecimal( rents.get( i ) ).add( r ).toString() );
} else {
interests.add( interest.toString() );
corpuss.add( corpus.toString() );
overCorpuss.add( cleanLeaseMoney.toString() );
rents.add( r.toString() );
}
}
}
FundRentPlanBean fundRentPlanBean = new FundRentPlanBean();
fundRentPlanBean.setCorpusOverageBusinessList( overCorpuss );
fundRentPlanBean.setCorpusBusinessList( corpuss );
fundRentPlanBean.setInterestBusinessList( interests );
fundRentPlanBean.setPlanDateList( dates );
fundRentPlanBean.setRentList( rents );
this.addRentPlan( fundRentPlanBean, tcb, startList );
return fundRentPlanBean;
}
public static BigDecimal getIRR( List cashFlows, BigDecimal incomeNumberYear ) {
List<BigDecimal> cashFlow = new ArrayList<>();
for ( int o = 0; o < cashFlows.size(); o ++ ) {
Object obj = cashFlows.get( o );
if ( obj instanceof BigDecimal ) {
cashFlow.add( ( BigDecimal ) obj );
} else {
cashFlow.add( new BigDecimal( obj.toString() ) );
}
}
BigDecimal up = BigDecimal.ONE;
BigDecimal down = BigDecimal.ZERO;
BigDecimal two = new BigDecimal( "2" );
BigDecimal irr = new BigDecimal( "0.01" );
BigDecimal accuracy = new BigDecimal( "0.0000001" );
BigDecimal out;
int i = 0;
while ( irr.abs().compareTo( accuracy ) > 0 && i < 200 ) {
out = cashFlow.get( 0 );
for ( int j = 1; j < cashFlow.size(); j ++ ) {
out = out.add( cashFlow.get( j ).divide( new BigDecimal( Math.pow( BigDecimal.ONE.add( irr ).doubleValue(), j ) ), 20, 4 ) );
}
if ( out.compareTo( BigDecimal.ZERO ) > 0 ) {
down = irr;
irr = irr.add( up ).divide( two, 20, 4 );
} else if ( out.compareTo( BigDecimal.ZERO ) < 0 ) {
up = irr;
irr = irr.add( down ).divide( two, 20, 4 );
}
i ++;
}
irr = irr.multiply( incomeNumberYear ).multiply( new BigDecimal( 100 ) );
return irr;
}
}

View File

@ -4,46 +4,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import jbo.app.tenwa.calc.LC_CALC_CONDITION;
import jbo.app.tenwa.calc.LC_CALC_CONDITION_HIS;
import jbo.app.tenwa.calc.LC_CALC_CONDITION_TEMP;
import jbo.app.tenwa.calc.LC_CALC_PERIOD;
import jbo.app.tenwa.calc.LC_CALC_PERIOD_TEMP;
import jbo.app.tenwa.calc.LC_CALC_RULES;
import jbo.app.tenwa.calc.LC_CALC_RULES_TEMP;
import jbo.app.tenwa.calc.LC_CALC_SUBSECTION;
import jbo.app.tenwa.calc.LC_CALC_SUBSECTION_TEMP;
import jbo.app.tenwa.calc.LC_CASH_FLOW;
import jbo.app.tenwa.calc.LC_CASH_FLOW_HIS;
import jbo.app.tenwa.calc.LC_CASH_FLOW_TEMP;
import jbo.app.tenwa.calc.LC_CONTRACT_CASH_FLOW;
import jbo.app.tenwa.calc.LC_CONTRACT_CONDITION;
import jbo.app.tenwa.calc.LC_CONTRACT_FUND_PLAN;
import jbo.app.tenwa.calc.LC_CONTRACT_PERIOD;
import jbo.app.tenwa.calc.LC_CONTRACT_RENT_PLAN;
import jbo.app.tenwa.calc.LC_CONTRACT_RULES;
import jbo.app.tenwa.calc.LC_CONTRACT_SUBSECTION;
import jbo.app.tenwa.calc.LC_CUSTOMER_CASH_FLOW;
import jbo.app.tenwa.calc.LC_CUSTOMER_CONDITION;
import jbo.app.tenwa.calc.LC_CUSTOMER_FUND_PLAN;
import jbo.app.tenwa.calc.LC_CUSTOMER_PERIOD;
import jbo.app.tenwa.calc.LC_CUSTOMER_RENT_PLAN;
import jbo.app.tenwa.calc.LC_CUSTOMER_RULES;
import jbo.app.tenwa.calc.LC_CUSTOMER_SUBSECTION;
import jbo.app.tenwa.calc.LC_FUND_PLAN;
import jbo.app.tenwa.calc.LC_FUND_PLAN_TEMP;
import jbo.app.tenwa.calc.LC_PAY_CASH_FLOW;
import jbo.app.tenwa.calc.LC_PAY_RENT_PLAN;
import jbo.app.tenwa.calc.LC_PROJ_CASH_FLOW;
import jbo.app.tenwa.calc.LC_PROJ_CONDITION;
import jbo.app.tenwa.calc.LC_PROJ_FUND_PLAN;
import jbo.app.tenwa.calc.LC_PROJ_PERIOD;
import jbo.app.tenwa.calc.LC_PROJ_RENT_PLAN;
import jbo.app.tenwa.calc.LC_PROJ_RULES;
import jbo.app.tenwa.calc.LC_PROJ_SUBSECTION;
import jbo.app.tenwa.calc.LC_RENT_PLAN;
import jbo.app.tenwa.calc.LC_RENT_PLAN_HIS;
import jbo.app.tenwa.calc.LC_RENT_PLAN_TEMP;
import jbo.app.tenwa.calc.*;
import jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT;
import jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO_TEMP;
import jbo.com.tenwa.lease.comm.LB_PROJECT_INFO;
@ -70,14 +31,14 @@ public class CalcConditionCopyService {
public void custToTemp(String flowunid,String quotid,String planCName,String planCValue,JBOTransaction tx) throws JBOException, RecordNotFoundException, Exception{
Map<String,String> fromCondition=new HashMap<String, String>();
fromCondition.put("quot_id", quotid);
Map<String,String> otherProperty=new HashMap<String, String>();
otherProperty.put("FLOWUNID", flowunid);
otherProperty.put(planCName, planCValue);
Map<String,String> toCondition=new HashMap<String, String>();
toCondition.put(planCName, planCValue);
//商务条件
DataOperatorUtil.copyJBOSet(LC_CUSTOMER_CONDITION.CLASS_NAME, fromCondition,LC_CALC_CONDITION_TEMP.CLASS_NAME, toCondition, otherProperty, null, tx);
//测算租金规则
@ -93,22 +54,22 @@ public class CalcConditionCopyService {
//分段测算
DataOperatorUtil.copyJBOSet(LC_CUSTOMER_SUBSECTION.CLASS_NAME, fromCondition, LC_CALC_SUBSECTION_TEMP.CLASS_NAME, toCondition, otherProperty, null, tx);
}
//临时表到项目表
public void tempToProj(String flowunid,JBOTransaction tx) throws Exception{
BizObject flow=JBOFactory.createBizObjectQuery(FLOW_BUSSINESS_OBJECT.CLASS_NAME,"flow_unid=:flowunid").setParameter("flowunid", flowunid).getSingleResult(false);
String projid=flow.getAttribute("proj_id").getString();
Map<String,String> fromCondition=new HashMap<String, String>();
fromCondition.put("FLOWUNID", flowunid);
Map<String,String> toCondition=new HashMap<String, String>();
toCondition.put("PROJECT_ID", projid);
Map<String,String> otherProperty=new HashMap<String, String>();
otherProperty.put("project_id", projid);
//商务条件
@ -126,15 +87,19 @@ public class CalcConditionCopyService {
DataOperatorUtil.copyJBOSet(LC_CALC_SUBSECTION_TEMP.CLASS_NAME, fromCondition, LC_PROJ_SUBSECTION.CLASS_NAME, toCondition, otherProperty, null, tx);
//前提条件
DataOperatorUtil.copyJBOSet(LC_CONDITION_TEMP.CLASS_NAME, fromCondition, LC_CONDITION.CLASS_NAME, toCondition, otherProperty, null, tx);
// 分段融导表
DataOperatorUtil.copyJBOSet(LC_CALC_SUBSECTION_INFO_TEMP.CLASS_NAME, fromCondition, LC_PROJ_SUBSECTION_INFO.CLASS_NAME, toCondition, otherProperty, null, tx);
// 分段租金计划导表
DataOperatorUtil.copyJBOSet(LC_SUBSECTION_RENT_PLAN_TEMP.CLASS_NAME, fromCondition, LC_PROJ_SUBSECTION_RENT_PLAN.CLASS_NAME, toCondition, otherProperty, null, tx);
}
//项目表到临时表
public void porjToTemp(String flowunid,String projid,JBOTransaction tx) throws Exception{
Map<String,String> fromCondition=new HashMap<String, String>();
fromCondition.put("PROJECT_ID", projid);
Map<String,String> otherProperty=new HashMap<String, String>();
otherProperty.put("FLOWUNID", flowunid);
//商务条件
@ -153,39 +118,42 @@ public class CalcConditionCopyService {
DataOperatorUtil.copyJBOSet(LC_PROJ_SUBSECTION.CLASS_NAME, fromCondition, LC_CALC_SUBSECTION_TEMP.CLASS_NAME, null, otherProperty, null, tx);
//前提条件
DataOperatorUtil.copyJBOSet(LC_CONDITION.CLASS_NAME, fromCondition, LC_CONDITION_TEMP.CLASS_NAME, null, otherProperty, null, tx);
// 分段融导表
DataOperatorUtil.copyJBOSet(LC_PROJ_SUBSECTION_INFO.CLASS_NAME, fromCondition, LC_CALC_SUBSECTION_INFO_TEMP.CLASS_NAME, null, otherProperty, null, tx);
// 分段租金计划导表
DataOperatorUtil.copyJBOSet(LC_PROJ_SUBSECTION_RENT_PLAN.CLASS_NAME, fromCondition, LC_SUBSECTION_RENT_PLAN_TEMP.CLASS_NAME, null, otherProperty, null, tx);
}
//项目表到合同临时表
public void projToContract(String flowunid,String projid,String contractid,JBOTransaction tx) throws Exception{
BizObject proj=JBOFactory.createBizObjectQuery(LB_PROJECT_INFO.CLASS_NAME,"id=:id").setParameter("id", projid).getSingleResult(false);
String project_id=proj.getAttribute("project_no").getString();//项目编号
Map<String,String> fromCondition=new HashMap<String, String>();
fromCondition.put("PROJECT_ID", projid);
List<BizObject> list=DataOperatorUtil.getSetJBO(LC_PROJ_CONDITION.CLASS_NAME, fromCondition, tx);
Map<String,String> otherProperty=new HashMap<String, String>();
otherProperty.put("FLOWUNID", flowunid);
for(BizObject bo:list){
String projPlanNumber=bo.getAttribute("PROJECT_PLAN_NUMBER").getString();
String contractPlanNumber=projPlanNumber.replace(project_id, contractid);
fromCondition.clear();
fromCondition.put("PROJECT_ID", projid);
fromCondition.put("PROJECT_PLAN_NUMBER", projPlanNumber);
otherProperty.clear();
otherProperty.put("FLOWUNID", flowunid);
otherProperty.put("CONTRACT_PLAN_NUMBER", contractPlanNumber);
//商务条件
DataOperatorUtil.copyJBOSet(LC_PROJ_CONDITION.CLASS_NAME, fromCondition,LC_CALC_CONDITION_TEMP.CLASS_NAME, null, otherProperty, null, tx);
//测算租金规则
@ -200,28 +168,31 @@ public class CalcConditionCopyService {
DataOperatorUtil.copyJBOSet(LC_PROJ_PERIOD.CLASS_NAME, fromCondition, LC_CALC_PERIOD_TEMP.CLASS_NAME, null, otherProperty, null, tx);
//分段测算
DataOperatorUtil.copyJBOSet(LC_PROJ_SUBSECTION.CLASS_NAME, fromCondition, LC_CALC_SUBSECTION_TEMP.CLASS_NAME, null, otherProperty, null, tx);
// 分段融导表
DataOperatorUtil.copyJBOSet(LC_PROJ_SUBSECTION_INFO.CLASS_NAME, fromCondition, LC_CALC_SUBSECTION_INFO_TEMP.CLASS_NAME, null, otherProperty, null, tx);
// 分段租金计划导表
DataOperatorUtil.copyJBOSet(LC_PROJ_SUBSECTION_RENT_PLAN.CLASS_NAME, fromCondition, LC_SUBSECTION_RENT_PLAN_TEMP.CLASS_NAME, null, otherProperty, null, tx);
otherProperty.clear();
otherProperty.put("FLOWUNID", flowunid);
otherProperty.put("PLAN_NUMBER", contractPlanNumber);
//付款前提
DataOperatorUtil.copyJBOSet(LC_PAY_CONDTION.CLASS_NAME, fromCondition, LC_PAY_CONDTION_TEMP.CLASS_NAME, null, otherProperty, null, tx);
}
}
//合同层 单次起租 临时 到正式
public void tempToContractOne(String flowunid,String contractid,JBOTransaction tx) throws Exception{
BizObject contract=JBOFactory.createBizObjectQuery(LB_CONTRACT_INFO_TEMP.CLASS_NAME,"flowunid=:flowunid").setParameter("flowunid", flowunid).getSingleResult(false);
String paymentNumber=SerialNumberUtil.getPlannumber(contract.getAttribute("CONTRACT_NO").getString(),"pay_process", tx);
Map<String,String> fromCondition=new HashMap<String, String>();
fromCondition.put("FLOWUNID", flowunid);
Map<String,String> toCondition=new HashMap<String, String>();
toCondition.put("contract_id", contractid);
Map<String,String> otherProperty=new HashMap<String, String>();
otherProperty.put("contract_id", contractid);
otherProperty.put("PAYMENT_NUMBER", paymentNumber);
@ -239,7 +210,10 @@ public class CalcConditionCopyService {
DataOperatorUtil.copyJBOSet(LC_CALC_PERIOD_TEMP.CLASS_NAME, fromCondition, LC_CONTRACT_PERIOD.CLASS_NAME, toCondition, otherProperty, null, tx);
//分段测算
DataOperatorUtil.copyJBOSet(LC_CALC_SUBSECTION_TEMP.CLASS_NAME, fromCondition, LC_CONTRACT_SUBSECTION.CLASS_NAME, toCondition, otherProperty, null, tx);
// 分段融导表
DataOperatorUtil.copyJBOSet(LC_CALC_SUBSECTION_INFO_TEMP.CLASS_NAME, fromCondition, LC_CONTRACT_SUBSECTION_INFO.CLASS_NAME, toCondition, otherProperty, null, tx);
// 分段租金计划导表
DataOperatorUtil.copyJBOSet(LC_SUBSECTION_RENT_PLAN_TEMP.CLASS_NAME, fromCondition, LC_CONTRACT_SUBSECTION_RENT_PLAN.CLASS_NAME, toCondition, otherProperty, null, tx);
//商务条件
DataOperatorUtil.copyJBOSet(LC_CALC_CONDITION_TEMP.CLASS_NAME, fromCondition,LC_CALC_CONDITION.CLASS_NAME, toCondition, otherProperty, null, tx);
@ -255,22 +229,27 @@ public class CalcConditionCopyService {
DataOperatorUtil.copyJBOSet(LC_CALC_PERIOD_TEMP.CLASS_NAME, fromCondition, LC_CALC_PERIOD.CLASS_NAME, toCondition, otherProperty, null, tx);
//分段测算
DataOperatorUtil.copyJBOSet(LC_CALC_SUBSECTION_TEMP.CLASS_NAME, fromCondition, LC_CALC_SUBSECTION.CLASS_NAME, toCondition, otherProperty, null, tx);
// 分段融导表
DataOperatorUtil.copyJBOSet(LC_CALC_SUBSECTION_INFO_TEMP.CLASS_NAME, fromCondition, LC_CALC_SUBSECTION_INFO.CLASS_NAME, toCondition, otherProperty, null, tx);
// 分段租金计划导表
DataOperatorUtil.copyJBOSet(LC_SUBSECTION_RENT_PLAN_TEMP.CLASS_NAME, fromCondition, LC_SUBSECTION_RENT_PLAN.CLASS_NAME, toCondition, otherProperty, null, tx);
//付款前提
LeaseFlowBaseService service=new LeaseFlowBaseServiceImp();
service.copyOrLoadPayCondtionInfo(tx, fromCondition,toCondition,otherProperty, ServiceOperatorEnum.TempToFormal,null);
HandlingApportionManager.setSingleHandlingApportion(flowunid,contractid,paymentNumber,tx);
}
//合同层 多次起租 临时 到正式
public void tempToContractMany(String flowunid,String contractid,JBOTransaction tx) throws Exception{
Map<String,String> fromCondition=new HashMap<String, String>();
fromCondition.put("FLOWUNID", flowunid);
Map<String,String> toCondition=new HashMap<String, String>();
toCondition.put("contract_id", contractid);
Map<String,String> otherProperty=new HashMap<String, String>();
otherProperty.put("contract_id", contractid);
//商务条件
@ -287,17 +266,22 @@ public class CalcConditionCopyService {
DataOperatorUtil.copyJBOSet(LC_CALC_PERIOD_TEMP.CLASS_NAME, fromCondition, LC_CONTRACT_PERIOD.CLASS_NAME, toCondition, otherProperty, null, tx);
//分段测算
DataOperatorUtil.copyJBOSet(LC_CALC_SUBSECTION_TEMP.CLASS_NAME, fromCondition, LC_CONTRACT_SUBSECTION.CLASS_NAME, toCondition, otherProperty, null, tx);
// 分段融导表
DataOperatorUtil.copyJBOSet(LC_CALC_SUBSECTION_INFO_TEMP.CLASS_NAME, fromCondition, LC_CONTRACT_SUBSECTION_INFO.CLASS_NAME, toCondition, otherProperty, null, tx);
// 分段租金计划导表
DataOperatorUtil.copyJBOSet(LC_SUBSECTION_RENT_PLAN_TEMP.CLASS_NAME, fromCondition, LC_CONTRACT_SUBSECTION_RENT_PLAN.CLASS_NAME, toCondition, otherProperty, null, tx);
//付款前提
LeaseFlowBaseService service=new LeaseFlowBaseServiceImp();
service.copyOrLoadPayCondtionInfo(tx, fromCondition,toCondition,otherProperty, ServiceOperatorEnum.TempToFormal,null);
}
//合同正式到临时
public void contractTotemp(String flowunid,String contractid,JBOTransaction tx) throws Exception{
Map<String,String> fromCondition=new HashMap<String, String>();
fromCondition.put("contract_id", contractid);
Map<String,String> otherProperty=new HashMap<String, String>();
otherProperty.put("FLOWUNID", flowunid);
//商务条件
@ -314,21 +298,26 @@ public class CalcConditionCopyService {
DataOperatorUtil.copyJBOSet(LC_CONTRACT_PERIOD.CLASS_NAME, fromCondition, LC_CALC_PERIOD_TEMP.CLASS_NAME, null, otherProperty, null, tx);
//分段测算
DataOperatorUtil.copyJBOSet(LC_CONTRACT_SUBSECTION.CLASS_NAME, fromCondition, LC_CALC_SUBSECTION_TEMP.CLASS_NAME, null, otherProperty, null, tx);
// 分段融导表
DataOperatorUtil.copyJBOSet(LC_CONTRACT_SUBSECTION_INFO.CLASS_NAME, fromCondition, LC_CALC_SUBSECTION_INFO_TEMP.CLASS_NAME, null, otherProperty, null, tx);
// 分段租金计划导表
DataOperatorUtil.copyJBOSet(LC_CONTRACT_SUBSECTION_RENT_PLAN.CLASS_NAME, fromCondition, LC_SUBSECTION_RENT_PLAN_TEMP.CLASS_NAME, null, otherProperty, null, tx);
}
//临时到投放
public void tempToPay(String flowunid,String paymentNumber,JBOTransaction tx) throws Exception{
BizObject flow=JBOFactory.createBizObjectQuery(FLOW_BUSSINESS_OBJECT.CLASS_NAME,"flow_unid=:flowunid").setParameter("flowunid", flowunid).getSingleResult(false);
String contractid=flow.getAttribute("contract_id").getString();
Map<String,String> fromCondition=new HashMap<String, String>();
fromCondition.put("PAYMENT_NUMBER", paymentNumber);
fromCondition.put("flowunid", flowunid);
Map<String,String> toCondition=new HashMap<String, String>();
toCondition.put("PAYMENT_NUMBER", paymentNumber);
Map<String,String> otherProperty=new HashMap<String, String>();
otherProperty.put("contract_id", contractid);
//商务条件
@ -345,15 +334,19 @@ public class CalcConditionCopyService {
DataOperatorUtil.copyJBOSet(LC_CALC_PERIOD_TEMP.CLASS_NAME, fromCondition, LC_CALC_PERIOD.CLASS_NAME, toCondition, otherProperty, null, tx);
//分段测算
DataOperatorUtil.copyJBOSet(LC_CALC_SUBSECTION_TEMP.CLASS_NAME, fromCondition, LC_CALC_SUBSECTION.CLASS_NAME, toCondition, otherProperty, null, tx);
// 分段融导表
DataOperatorUtil.copyJBOSet(LC_CALC_SUBSECTION_INFO_TEMP.CLASS_NAME, fromCondition, LC_CALC_SUBSECTION_INFO.CLASS_NAME, toCondition, otherProperty, null, tx);
// 分段租金计划导表
DataOperatorUtil.copyJBOSet(LC_SUBSECTION_RENT_PLAN_TEMP.CLASS_NAME, fromCondition, LC_SUBSECTION_RENT_PLAN.CLASS_NAME, toCondition, otherProperty, null, tx);
HandlingApportionManager.setHandlingApportion(flowunid,contractid,paymentNumber,tx);
}
//投放到临时
public void payToTemp(String flowunid,String paymentNumber,JBOTransaction tx) throws Exception{
Map<String,String> fromCondition=new HashMap<String, String>();
fromCondition.put("PAYMENT_NUMBER", paymentNumber);
Map<String,String> otherProperty=new HashMap<String, String>();
otherProperty.put("FLOWUNID", flowunid);
//商务条件
@ -370,21 +363,24 @@ public class CalcConditionCopyService {
DataOperatorUtil.copyJBOSet(LC_CALC_PERIOD.CLASS_NAME, fromCondition, LC_CALC_PERIOD_TEMP.CLASS_NAME, null, otherProperty, null, tx);
//分段测算
DataOperatorUtil.copyJBOSet(LC_CALC_SUBSECTION.CLASS_NAME, fromCondition, LC_CALC_SUBSECTION_TEMP.CLASS_NAME, null, otherProperty, null, tx);
// 分段融导表
DataOperatorUtil.copyJBOSet(LC_CALC_SUBSECTION_INFO.CLASS_NAME, fromCondition, LC_CALC_SUBSECTION_INFO_TEMP.CLASS_NAME, null, otherProperty, null, tx);
// 分段租金计划导表
DataOperatorUtil.copyJBOSet(LC_SUBSECTION_RENT_PLAN.CLASS_NAME, fromCondition, LC_SUBSECTION_RENT_PLAN_TEMP.CLASS_NAME, null, otherProperty, null, tx);
}
//临时到起租
public void tempToOnhire(String flowunid,String paymentNumber,String contractid,JBOTransaction tx) throws Exception{
Map<String,String> fromCondition=new HashMap<String, String>();
fromCondition.put("FLOWUNID", flowunid);
fromCondition.put("PAYMENT_NUMBER", paymentNumber);
Map<String,String> toCondition=new HashMap<String, String>();
toCondition.put("PAYMENT_NUMBER", paymentNumber);
Map<String,String> otherProperty=new HashMap<String, String>();
otherProperty.put("contract_id", contractid);
CalcRentCompare com=new CalcRentCompare();
//商务条件
DataOperatorUtil.copyJBOSet(LC_CALC_CONDITION_TEMP.CLASS_NAME, fromCondition,LC_CALC_CONDITION.CLASS_NAME, toCondition, otherProperty, null, tx);
@ -394,14 +390,18 @@ public class CalcConditionCopyService {
DataOperatorUtil.copyJBOSet(LC_FUND_PLAN_TEMP.CLASS_NAME, fromCondition,LC_FUND_PLAN.CLASS_NAME, toCondition, otherProperty, com, tx);
//现金流
DataOperatorUtil.copyJBOSet(LC_CASH_FLOW_TEMP.CLASS_NAME, fromCondition, LC_CASH_FLOW.CLASS_NAME, toCondition, otherProperty, null, tx);
// 分段融导表
DataOperatorUtil.copyJBOSet(LC_CALC_SUBSECTION_INFO_TEMP.CLASS_NAME, fromCondition, LC_CALC_SUBSECTION_INFO.CLASS_NAME, toCondition, otherProperty, null, tx);
// 分段租金计划导表
DataOperatorUtil.copyJBOSet(LC_SUBSECTION_RENT_PLAN_TEMP.CLASS_NAME, fromCondition, LC_SUBSECTION_RENT_PLAN.CLASS_NAME, toCondition, otherProperty, null, tx);
//HandlingApportionManager.setHandlingApportion(flowunid,contractid,paymentNumber,tx);
}
//起租到临时
public void onhireToTemp(String flowunid,String paymentNumber,JBOTransaction tx) throws Exception{
Map<String,String> fromCondition=new HashMap<String, String>();
fromCondition.put("PAYMENT_NUMBER", paymentNumber);
Map<String,String> otherProperty=new HashMap<String, String>();
otherProperty.put("FLOWUNID", flowunid);
//商务条件
@ -418,13 +418,17 @@ public class CalcConditionCopyService {
DataOperatorUtil.copyJBOSet(LC_CALC_PERIOD.CLASS_NAME, fromCondition, LC_CALC_PERIOD_TEMP.CLASS_NAME, null, otherProperty, null, tx);
//分段测算
DataOperatorUtil.copyJBOSet(LC_CALC_SUBSECTION.CLASS_NAME, fromCondition, LC_CALC_SUBSECTION_TEMP.CLASS_NAME, null, otherProperty, null, tx);
// 分段融导表
DataOperatorUtil.copyJBOSet(LC_CALC_SUBSECTION_INFO.CLASS_NAME, fromCondition, LC_CALC_SUBSECTION_INFO_TEMP.CLASS_NAME, null, otherProperty, null, tx);
// 分段租金计划导表
DataOperatorUtil.copyJBOSet(LC_SUBSECTION_RENT_PLAN.CLASS_NAME, fromCondition, LC_SUBSECTION_RENT_PLAN_TEMP.CLASS_NAME, null, otherProperty, null, tx);
}
//起租到临时
public void onhireToTempList(String flowunid,String contractid,JBOTransaction tx) throws Exception{
Map<String,String> fromCondition=new HashMap<String, String>();
fromCondition.put("contract_id", contractid);
Map<String,String> otherProperty=new HashMap<String, String>();
otherProperty.put("FLOWUNID", flowunid);
//商务条件
@ -450,6 +454,10 @@ public class CalcConditionCopyService {
DataOperatorUtil.copyJBOSet(LC_CALC_PERIOD.CLASS_NAME, fromCondition, LC_CALC_PERIOD_TEMP.CLASS_NAME, null, otherProperty, null, tx);
//分段测算
DataOperatorUtil.copyJBOSet(LC_CALC_SUBSECTION.CLASS_NAME, fromCondition, LC_CALC_SUBSECTION_TEMP.CLASS_NAME, null, otherProperty, null, tx);
// 分段融导表
DataOperatorUtil.copyJBOSet(LC_CALC_SUBSECTION_INFO.CLASS_NAME, fromCondition, LC_CALC_SUBSECTION_INFO_TEMP.CLASS_NAME, null, otherProperty, null, tx);
// 分段租金计划导表
DataOperatorUtil.copyJBOSet(LC_SUBSECTION_RENT_PLAN.CLASS_NAME, fromCondition, LC_SUBSECTION_RENT_PLAN_TEMP.CLASS_NAME, null, otherProperty, null, tx);
}
//租金计划历史
public void onhireToHis(String flowunid,String paymentNumber,JBOTransaction tx) throws Exception{
@ -463,6 +471,10 @@ public class CalcConditionCopyService {
DataOperatorUtil.copyJBOSet(LC_RENT_PLAN.CLASS_NAME, fromCondition,LC_RENT_PLAN_HIS.CLASS_NAME, null, other, null, tx);
//现金流
DataOperatorUtil.copyJBOSet(LC_CASH_FLOW.CLASS_NAME, fromCondition, LC_CASH_FLOW_HIS.CLASS_NAME, null, other, null, tx);
// 分段融导表
DataOperatorUtil.copyJBOSet(LC_CALC_SUBSECTION_INFO.CLASS_NAME, fromCondition, LC_CALC_SUBSECTION_INFO_HIS.CLASS_NAME, null, other, null, tx);
// 分段租金计划导表
DataOperatorUtil.copyJBOSet(LC_SUBSECTION_RENT_PLAN.CLASS_NAME, fromCondition, LC_SUBSECTION_RENT_PLAN_HIS.CLASS_NAME, null, other, null, tx);
}
}

View File

@ -17,7 +17,7 @@ import com.tenwa.reckon.constant.Scale;
import com.tenwa.reckon.exception.LeasingException;
/**
*
*
* @author SHIHONGFEI
* @version 1.0
* @copyright (C) TENWA 2011
@ -27,9 +27,9 @@ import com.tenwa.reckon.exception.LeasingException;
public class IrrTools {
/**
*
*
* ( 根据配置信息构建现金流执行语句,如有其它现金流信息的可在此构建时修改)
*
*
* @param cfgb_list
* @param tcb
* @return
@ -55,9 +55,9 @@ public class IrrTools {
}
/**
*
*
* ( 得到去除重复的时间集合返回一个含有一个时间对应他的现金集合的下标的键值对 ,如按天则substring(0, 7)需处理)
*
*
* @param ccfbList
* @return
*/
@ -80,9 +80,9 @@ public class IrrTools {
}
/**
*
*
* ( 根据时间得到新的现金流集合 )
*
*
* @param ht_date 现金流对应日期
* @param cdbList 现金流集合
* @return
@ -106,10 +106,10 @@ public class IrrTools {
String quot_id = "";// 报价编号
String contract_id = ""; // 合同号
String plan_date = obj[i].toString();// 日期
String fund_in = "0"; // 流入量
String fund_in_details = ""; // 流入量清单
String fund_out = "0"; // 流出量
String fund_out_details = ""; // 流出量清单
@ -152,7 +152,7 @@ public class IrrTools {
/**
* 根据租金现金流偿还间隔租金间隔年还款次数测算irr
*
*
* @param l_inflow_pour所有现金流入流出
* @param chjg偿还间隔
* @param zjjg租金间隔
@ -235,7 +235,7 @@ public class IrrTools {
/**
* XIRR计算公式 参数1 l_inflow_pour 是对于的现金流,参数2l_date 是对于的现金流时间 这个需要一一对于. <br>
* 这个算法对于的是EXECL中的XIRR算法.可以用于精确到日的 日IRR计算
*
*
* @param l_inflow_pour
* 现金流List
* @param l_date
@ -277,9 +277,9 @@ public class IrrTools {
}
/**
*
*
* ( 得到保证金抵扣现金流明细)
*
*
* @param rent_list
* @param caut_money
* @return
@ -321,9 +321,9 @@ public class IrrTools {
}
/**
*
*
* 保证金抵扣金额小于保证金金额 最后要做一笔流出 为保证金金额减去保证金抵扣金额)
*
*
* @param cdbList
* 现金流
* @param caution_money
@ -352,9 +352,9 @@ public class IrrTools {
}
/**
*
*
* ( 得到预收租金抵扣现金流明细)
*
*
* @param rent_list
* @param rentbefore_money
* @return
@ -400,9 +400,9 @@ public class IrrTools {
}
/**
*
*
* 预收租金抵扣金额小于预收租金金额 最后要做一笔流出 为预收租金金额减去预收租金抵扣金额)
*
*
* @param cdbList
* 现金流
* @param Column_8
@ -430,9 +430,9 @@ public class IrrTools {
}
/**
*
*
* ( 得到可以保证金抵扣的租金下标值)
*
*
* @param cdbList
* @param caut_money
* @param d_total
@ -453,10 +453,10 @@ public class IrrTools {
int_s = int_s.indexOf(",") > -1 ? int_s.substring(0, int_s.length() - 1) : int_s;// 得到可以抵扣的租金的下标
return int_s;
}
/**
*
*
* ( 对最后一项现金流明细进行整理,如有变更的可以重写此方法)
* 其他情况
* @param cdbList
@ -471,10 +471,10 @@ public class IrrTools {
String planDate = cdb.getPlanDate(); // 日期 (只有年月)
String income_number_year = cb.getIncomeNumberYear();
int onhire_id = cdb.getOnhire_id();
//起租类型 注意: 期初 数字 1 字符串 period_type_1 #分割线# 期末 数字0 字符串 period_type_0
String periodType = cb.getPeriodType();
// 更新流入净流量值 期末余值
if ( null != equip_end_value && !"".equals(equip_end_value) && Double.parseDouble(equip_end_value) > Double.parseDouble("0.00") ) {// 期末残值大于0时
//期末余值期末情况下的统一处理方式:直接加在最后一期现金流数据中
@ -484,53 +484,53 @@ public class IrrTools {
cdb.setNetFlow(String.valueOf(Double.parseDouble(cdb.getNetFlow()) + Double.parseDouble(equip_end_value)));
}
}
//期末购买权在月付双月付情况下在下方单独处理
if (null != nominal_price && !"".equals(nominal_price) && Double.parseDouble(nominal_price) > Double.parseDouble("0.00") && !"income_1".equals(income_number_year) && !"income_2".equals(income_number_year) && !"6".equals(income_number_year) && !"12".equals(income_number_year) || ( "period_type_0".equals(periodType) || "0".equals(periodType) ) ) {// 期末购买权原名称:名义货价大于0时
cdb.setFundIn(String.valueOf(Double.parseDouble(cdb.getFundIn()) + Double.parseDouble(nominal_price)));
cdb.setFundInDetails(cdb.getFundInDetails() + ";期末购买权:" + NumTools.formatNumberDouble(Double.parseDouble(NumTools.formatNumberDoubleScale(nominal_price, 2))) + "");
cdb.setNetFlow(String.valueOf(Double.parseDouble(cdb.getNetFlow()) + Double.parseDouble(nominal_price)));
}
// 重新设置此元素的值
cdbList.set(cdbList.size() - 1, cdb);
// 处理特殊的保证金抵扣 保证金抵扣金额小于保证金金额 最后要做一笔流出 为保证金金额减去保证金抵扣金额
cdbList = IrrTools.getRentDetailsByDeductOut(cdbList, cb.getCautionMoney(), cb.getCautionDeductionMoney());
List<CashDetailsBean> new_cdbList = new ArrayList<CashDetailsBean>();
for (CashDetailsBean obj : cdbList) {
new_cdbList.add(obj);
}
//TODO:sea 期末购买权在月付情况下最后一期日期加一月作为单独的一行数据,其它情况下最后一期的日期
//TODO:sea 期末购买权在月付情况下最后一期日期加一月作为单独的一行数据,其它情况下最后一期的日期
//2014-06-11 期末余值新的处理逻辑:符合期末购买权月付/双月付情况这个前提下 期初情况的期末余值期末购买权一致放在新增的一期一起作为最后一期现金流的数据
if(null != nominal_price && !"".equals(nominal_price) && Double.parseDouble(nominal_price) > Double.parseDouble("0.00") && !Tools.isNullOrEmpty(planDate) && ( "income_1".equals(income_number_year) || "12".equals(income_number_year) || "income_2".equals(income_number_year) || "6".equals(income_number_year) ) && ("period_type_1".equals(periodType) || "1".equals(periodType)) ){//月付/双月付情况下
//重新取一次值
CashDetailsBean new_cdb = new CashDetailsBean();//cdbList.get(cdbList.size() - 1);
planDate = planDate+"-01";//构建成完整的日期格式
//2014-01-01 日期加1个月
//2014-01-01 日期加1个月
planDate = DateTools.getDateAdd(planDate, 1, "mm");
new_cdb.setPlanDate(planDate.substring(0, 7)+"-01");
new_cdb.setFundOut("0");
new_cdb.setFundOutDetails("");
new_cdb.setFundIn(String.valueOf(Double.parseDouble(nominal_price) + Double.parseDouble(equip_end_value)));
new_cdb.setFundInDetails("期末购买权:" + NumTools.formatNumberDouble(Double.parseDouble(NumTools.formatNumberDoubleScale(nominal_price, 2))) + ";期末余值:" + NumTools.formatNumberDouble(Double.parseDouble(NumTools.formatNumberDoubleScale(equip_end_value, 2))));
new_cdb.setNetFlow( String.valueOf( Double.parseDouble(nominal_price) + Double.parseDouble(equip_end_value) ) );
new_cdb.setOnhire_id( onhire_id + 1 );//现金流按固定格式补0情况下所以这里月付情况下直接最后一次变量加1做为最终的期末购买权排序依据
new_cdbList.add(new_cdb);
}else{
//TODO:2014-06-11 期末余值新的处理逻辑:不符合期末购买权月付情况这个前提下 期初情况的期末余值期末购买权一致放在新增的一期一起作为最后一期现金流的数据
//TODO:这里存在少处理不是月付情况例如季付情况下期末余值是不是不能直接最后一期加一个月是加一个租赁间隔是加一个季度三个月中间需要补两个0
if( !Tools.isNullOrEmpty(planDate) && null != equip_end_value && !"".equals(equip_end_value) && Double.parseDouble(equip_end_value) > Double.parseDouble("0.00") && ("period_type_1".equals(periodType) || "1".equals(periodType)) ){// 期初
//重新取一次值
CashDetailsBean new_cdb = new CashDetailsBean();//cdbList.get(cdbList.size() - 1);
planDate = planDate+"-01";//构建成完整的日期格式
//2014-01-01 日期加1个月
//2014-01-01 日期加1个月
planDate = DateTools.getDateAdd(planDate, 1, "mm");
new_cdb.setPlanDate(planDate.substring(0, 7)+"-01");
new_cdb.setFundOut("0");
@ -541,13 +541,13 @@ public class IrrTools {
new_cdb.setOnhire_id( onhire_id + 1 );//现金流按固定格式补0情况下所以这里月付情况下直接最后一次变量加1做为最终的期末购买权排序依据
new_cdbList.add(new_cdb);
}
}
return new_cdbList;
}
/**
* <p>对最后一项现金流明细进行整理,针对项目类型为VP业务情况下期末购买权不计算入最后一期现金流中</p>
* @author sea
@ -562,31 +562,31 @@ public class IrrTools {
// 更新流入净流量值
if (null != equip_end_value && !"".equals(equip_end_value) && Double.parseDouble(equip_end_value) > 0) {// 期末残值大于0时
cdb.setFundIn(String.valueOf(Double.parseDouble(cdb.getFundIn()) + Double.parseDouble(equip_end_value)));
cdb.setFundInDetails(cdb.getFundInDetails() + ";期末余值:" + NumTools.formatNumberDouble(Double.parseDouble(NumTools.formatNumberDoubleScale(equip_end_value, 2))));
cdb.setNetFlow(String.valueOf(Double.parseDouble(cdb.getNetFlow()) + Double.parseDouble(equip_end_value)));
}
if (null != nominal_price && !"".equals(nominal_price) && Double.parseDouble(nominal_price) > 0) {// 期末购买权原名称:名义货价大于0时
cdb.setFundIn(String.valueOf(Double.parseDouble(cdb.getFundIn()) + Double.parseDouble(nominal_price)));
//项目类型为VP业务情况下期末购买权不算入流入中
cdb.setFundInDetails( cdb.getFundInDetails() );
cdb.setNetFlow( cdb.getNetFlow() );
}
// 重新设置此元素的值
cdbList.set(cdbList.size() - 1, cdb);
// 2011-10-26
// 处理特殊的保证金抵扣 保证金抵扣金额小于保证金金额 最后要做一笔流出 为保证金金额减去保证金抵扣金额
cdbList = IrrTools.getRentDetailsByDeductOut(cdbList, cb.getCautionMoney(), cb.getCautionDeductionMoney());
return cdbList;
}
/**
*
*
* ( 现金流明细构建)
* 按月计算IRR
* @param cdbList
@ -595,7 +595,7 @@ public class IrrTools {
public static String getIrr(List<CashDetailsBean> cdbList) {
// 得到租金列表
List<String> rent_list = getRentListByCashDetails(cdbList);
/*
/*
* 后三个参数为固定按月计算
* @param chjg 固定值1
* @param zjjg 固定值1
@ -606,7 +606,7 @@ public class IrrTools {
}
/**
*
*
* @Title: getIrr
* @author zhangc
* @Description: 牛顿分切法计算XIRR
@ -624,7 +624,7 @@ public class IrrTools {
return IrrTools.getXIRR(rent_list, planDate_list).toString();
//return IrrTools.getIRR(rent_list, "1","1","12");
}
public static String getIrrNew( List<String> netList,List<String> dateList,String process) throws Exception {
// 得到租金列表
//List<String> rent_list = getRentListByCashDetails(cashlist,process);
@ -634,9 +634,9 @@ public class IrrTools {
//return IrrTools.getIRR(rent_list, "1","1","12");
}
/**
*
*
* ( 现金流明细构建)
*
*
* @param cdbList
* @param cb
* @return
@ -651,9 +651,9 @@ public class IrrTools {
}
/**
*
*
* ( 现金流明细构建)
*
*
* @param cdbList
* @param cb
* @return
@ -668,9 +668,9 @@ public class IrrTools {
}
/**
*
*
* ( 根据现金流明细得到新的租金列表用于算irr值)
*
*
* @param cdbList
*/
private static List<String> getRentListByCashDetails(List<CashDetailsBean> cdbList) {
@ -680,7 +680,7 @@ public class IrrTools {
}
return rent_list;
}
private static List<String> getRentListByCashDetails(List cdbList,String process) throws Exception {
List<String> rent_list = new ArrayList<String>();
for (Object cdb : cdbList) {
@ -691,12 +691,12 @@ public class IrrTools {
}else{
rent_list.add(((ContractCashDetailTemp)cdb).getNetFlow().toString());
}*/
rent_list.add(((BizObject)cdb).getAttribute("NET_FLOW").getString());
}
return rent_list;
}
private static List<String> getRentListByCashDetailsPlanDate(List cdbList,String process) throws Exception {
List<String> rent_list = new ArrayList<String>();
for (Object cdb : cdbList) {
@ -706,9 +706,9 @@ public class IrrTools {
}
/**
*
*
* ( 算出均息法下的均息法租金列表的irr,并把其当做年利率传递做第二次正常租金测算)
*
*
* @param cb
* 交易结构bean
* @param frpb
@ -734,7 +734,7 @@ public class IrrTools {
} else {
l_inflow_pour.add("-" + leasing_money);
}
for (int i = grace; i < rent_list.size(); i++) {
l_inflow_pour.add(rent_list.get(i).toString());
}
@ -745,16 +745,16 @@ public class IrrTools {
l_inflow_pour.set(l_inflow_pour.size()-1, new BigDecimal(l_inflow_pour.get(l_inflow_pour.size()-1)).add(new BigDecimal(cb.getEquipEndValue())).toString());
}
}
irr = IrrTools.getIRR(l_inflow_pour, String.valueOf(12 / Integer.parseInt(cb.getIncomeNumberYear())), String.valueOf(12 / Integer.parseInt(cb.getIncomeNumberYear())), cb.getIncomeNumberYear());
irr = Double.parseDouble(irr) + "";
return irr;
}
/**
*
*
* (根据现金流获得对应的年利率)
*
*
* @param alCash
* 现金流 用HashMap key为net_flow 存的每期的值
* @param income_number_year
@ -770,7 +770,7 @@ public class IrrTools {
}
return NumTools.formatNumberDoubleScale(Double.parseDouble(getIRR(alirr, "1", "1", income_number_year)) * 100 + "", 6);
}
/**
* <p>根据原始现金流集合按固定模式补0构建成独特格式的现金流</p>
* @author sea
@ -784,26 +784,26 @@ public class IrrTools {
List<CashDetailsBean> list = new ArrayList<CashDetailsBean>();
List<CashDetailsBean> cashList = new ArrayList<CashDetailsBean>();
// 期初期末支付 注意: 期初 数字 1 字符串 period_type_1 #分割线# 期末 数字0 字符串 period_type_0
String periodType = cb.getPeriodType();
String periodType = cb.getPeriodType();
if (ccfbList != null && ccfbList.size() > 0 && ccfbList.size() > size) {//现金流的长度如果小于2条该方法不适用特别是期初情况下理论上现金流只存在一行数据了
//第0期现金流集合
CashDetailsBean objFirst = new CashDetailsBean();
objFirst = ccfbList.get(0);//默认第0期的值等于原始现金流的第0期
double firstIn = 0.00;
double firstOut = 0.00;
double firstIn = 0.00;
double firstOut = 0.00;
String firstFundInDetails = "";
String firstFundOutDetails = "";
for (int i = 0; i < size; i++) {
CashDetailsBean oneObj = ccfbList.get(i);
//第i期流入流出
firstIn = firstIn + NumberUtils.parseDouble( NumberUtils.nullToZero( oneObj.getFundIn() ) );
firstOut = firstOut + NumberUtils.parseDouble( NumberUtils.nullToZero( oneObj.getFundOut() ) );
firstIn = firstIn + NumberUtils.parseDouble( NumberUtils.nullToZero( oneObj.getFundIn() ) );
firstOut = firstOut + NumberUtils.parseDouble( NumberUtils.nullToZero( oneObj.getFundOut() ) );
firstFundInDetails = firstFundInDetails +oneObj.getFundInDetails();
firstFundOutDetails = firstFundOutDetails+oneObj.getFundOutDetails();
}
//期初前收情况下:做合并处理
if("1".equals(periodType) || "period_type_1".equals(periodType)){
//封装新的第0期
@ -816,7 +816,7 @@ public class IrrTools {
objFirst.setNetFlow(NumberUtils.doubleToString( firstIn + firstRent - firstOut ) );
objFirst.setOnhire_id(1000);
cashList.add(objFirst);
//封装后续所有现金流
int key = 2;
int onhire_id = 1000;
@ -868,7 +868,7 @@ public class IrrTools {
}
return cashList;
}
/**
* <p>计算固定格式情况现金流补0个数</p>
* @author sea
@ -894,7 +894,7 @@ public class IrrTools {
}
return num;
}
/**
* <p>生成补0的现金流对象</p>
* @author sea
@ -915,14 +915,14 @@ public class IrrTools {
newObj.setOnhire_id(onhire_id);
return newObj;
}
/**
* 牛顿迭代法求IRR
* @param cashList:现金流List
* @return IRR
*/
public BigDecimal getIRR(List<BigDecimal> cashList){
public static BigDecimal getIRR(List<BigDecimal> cashList){
//long startTime = System.currentTimeMillis();
BigDecimal diff = BigDecimal.ONE; //租金现值总和与总本金的差值
BigDecimal irr = BigDecimal.ZERO;
@ -970,7 +970,7 @@ public class IrrTools {
BigDecimal daoRate=BigDecimal.ZERO; // 1/(1+irr)
BigDecimal netflowNow; //净流量现值
BigDecimal error = new BigDecimal("0.0000000001"); //误差
int size = cashList.size(); //现金流大小
int size = cashList.size(); //现金流大小
int j = 0; //迭代次数
double k = 0;
String startDate = "";
@ -990,7 +990,7 @@ public class IrrTools {
}catch(Exception e){
e.printStackTrace();
}
}
j++;
irr = irr.subtract(diff.divide(derivative, 20, BigDecimal.ROUND_HALF_UP)); //迭代关系式