diff --git a/calc/com/tenwa/reckon/executor/CashFlowExecutor.java b/calc/com/tenwa/reckon/executor/CashFlowExecutor.java index 61ad94304..187de77c6 100644 --- a/calc/com/tenwa/reckon/executor/CashFlowExecutor.java +++ b/calc/com/tenwa/reckon/executor/CashFlowExecutor.java @@ -50,7 +50,7 @@ public class CashFlowExecutor { String irr=""; if("STAGE_IRR".equals(cb.getIrrType())){//按期IRR BigDecimal issueRate=IRRCalculateUtil.getIRR2(netList); - irr=issueRate.multiply(new BigDecimal(1200/cb.getIncomeIntervalMonth())).setScale(6,BigDecimal.ROUND_HALF_UP).toString(); + irr=issueRate.multiply( new BigDecimal(1200/cb.getIncomeIntervalMonth())).setScale(6,BigDecimal.ROUND_HALF_UP).toString(); }else if("MONTH_IRR".equals(cb.getIrrType())){//按月IRR String upperListDate=""; List newNetList=new ArrayList(); @@ -97,6 +97,24 @@ public class CashFlowExecutor { private void add(ConditionBean cb,TabCalBean tcb) throws Exception{ Map> productRevenues = tcb.getProductRevenues(); + String GPSDifference = "0";//获取产品中的GPS差额配置 + Map GPSMap = productRevenues == null ? null : productRevenues.get( "GPSDifference" ); + if( GPSMap != null && GPSMap.size() > 0){ + GPSDifference = GPSMap.get("GPSDifference"); + if( GPSDifference == null || GPSDifference.isEmpty() ){ + GPSDifference = "0"; + } + } + + String personalInsuranceDifference = "0" ;//获取产品中的个人意外险差额配置 + Map pidMap = productRevenues == null ? null : productRevenues.get( "personalInsuranceDifference" ); + if( pidMap != null && pidMap.size() > 0){ + personalInsuranceDifference = pidMap.get("personalInsuranceDifference"); + if( personalInsuranceDifference == null || personalInsuranceDifference.isEmpty() ){ + personalInsuranceDifference = "0"; + } + } + String sql = ""; if("MYSQL".equals(InitDBType.DBTYPE)){ sql += "INSERT INTO " +Tools.getTable(tcb.getContractCashTb())+ " (id," + tcb.getPlanCName() + ""; @@ -128,12 +146,14 @@ public class CashFlowExecutor { sql +=" from "+Tools.getTable(tcb.getFundFundPlan_tb())+" fundplan " ; sql +=" left join code_library tdd on fundplan.fee_type = tdd.itemno and tdd.codeno='FeeType' " ; sql +=" where fundplan.flowunid = '"+ tcb.getDocId()+"' and fundplan."+tcb.getPlanCName()+"='"+tcb.getPlanCValue()+"' and fundplan.fee_type in ('feetype2','feetype1','feetype10','feetype16','feetype17','feetype33') "; - //如果是灵活产品减去产品中配置的GPS差额 - if("Y".equals( cb.getFlexible() ) ){ - Map> productRevenue = tcb.getProductRevenues(); - String GPSDifference = productRevenues.get( "GPSDifference" ).get( "GPSDifference" ); + //根据客户(张文竹)不管是否灵活产品,配置的GPS差额和个人意外险差额添加到IRR计算 + if( !"0".equals(personalInsuranceDifference) ){ + sql +=" union all select plan_date,'"+personalInsuranceDifference+"' flowin,'个人意外险差额:"+personalInsuranceDifference+"' flowindetail,'' flowout,'' flowoutdetil,'"+personalInsuranceDifference+"' cleanfow from lc_fund_plan_temp where flowunid = '"+tcb.getDocId()+"' and fee_type='feetype10' "; + } + if( !"0".equals(GPSDifference) ){ sql += "union all select plan_date,'"+GPSDifference+"' flowin,'GPS差额:"+GPSDifference+"' flowindetail,'' flowout,'' flowoutdetil,'"+GPSDifference+"' cleanfow from lc_fund_plan_temp where flowunid = '"+tcb.getDocId()+"' and fee_type='feetype10' "; } + }else if("ORACLE".equals(InitDBType.DBTYPE)){ sql += "INSERT INTO " +Tools.getTable(tcb.getContractCashTb())+ " (id," + tcb.getPlanCName() + ""; sql += ",plan_date"; diff --git a/calc/com/tenwa/reckon/executor/CreateTransactionExecutor.java b/calc/com/tenwa/reckon/executor/CreateTransactionExecutor.java index 979ba948a..44b734f15 100644 --- a/calc/com/tenwa/reckon/executor/CreateTransactionExecutor.java +++ b/calc/com/tenwa/reckon/executor/CreateTransactionExecutor.java @@ -150,7 +150,7 @@ public class CreateTransactionExecutor implements Transaction { } public void checkYearRate( ConditionBean cb, TabCalBean tcb, BigDecimal yearRate ) throws BusinessException { - if ( "Y".equals( cb.getFlexible() ) ) { +// if ( "Y".equals( cb.getFlexible() ) ) { // 灵活产品验证年利率区间 try { Map> productRevenues = ProductParamUtil.getProductComponentType( tcb.getProductId(), "PRD0390" ); @@ -164,18 +164,18 @@ public class CreateTransactionExecutor implements Transaction { if(!(yearRate.compareTo(new BigDecimal( prodRate )) == 0) ){ throw new BusinessException( "测算年利率跟产品配置的不相等,请检查!" ); } - } - //区间利率校验 - String rateMin = productRate.get("RateTermScope-MIN"); - String rateMax = productRate.get("RateTermScope-MAX"); - if ( !( yearRate.compareTo( new BigDecimal( rateMax ) ) <= 0 && yearRate.compareTo( new BigDecimal( rateMin ) ) >= 0 ) ) { - throw new BusinessException( "年利率: " + yearRate.setScale( 6, 4 ).toString() + ",不在产品配置区间范围内" ); + }else if("N".equals(isFixedRate)){//区间利率校验 + String rateMin = productRate.get("RateTermScope-MIN"); + String rateMax = productRate.get("RateTermScope-MAX"); + if ( !( yearRate.compareTo( new BigDecimal( rateMax ) ) <= 0 && yearRate.compareTo( new BigDecimal( rateMin ) ) >= 0 ) ) { + throw new BusinessException( "年利率: " + yearRate.setScale( 6, 4 ).toString() + ",不在产品配置区间范围内" ); + } } } catch ( Exception e ) { e.printStackTrace(); throw new BusinessException( e.getMessage() ); } - } +// } } /**