IRR计算添加GPS差额和个人意外险差额

This commit is contained in:
32189 2021-04-23 16:16:52 +08:00
parent 546b8389f8
commit 7f11dc61d5
2 changed files with 33 additions and 13 deletions

View File

@ -50,7 +50,7 @@ public class CashFlowExecutor {
String irr=""; String irr="";
if("STAGE_IRR".equals(cb.getIrrType())){//°´ÆÚIRR if("STAGE_IRR".equals(cb.getIrrType())){//°´ÆÚIRR
BigDecimal issueRate=IRRCalculateUtil.getIRR2(netList); 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 }else if("MONTH_IRR".equals(cb.getIrrType())){//°´ÔÂIRR
String upperListDate=""; String upperListDate="";
List<BigDecimal> newNetList=new ArrayList<BigDecimal>(); List<BigDecimal> newNetList=new ArrayList<BigDecimal>();
@ -97,6 +97,24 @@ public class CashFlowExecutor {
private void add(ConditionBean cb,TabCalBean tcb) throws Exception{ private void add(ConditionBean cb,TabCalBean tcb) throws Exception{
Map<String, Map<String, String>> productRevenues = tcb.getProductRevenues(); Map<String, Map<String, String>> productRevenues = tcb.getProductRevenues();
String GPSDifference = "0";//获取产品中的GPS差额配置
Map<String, String> 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<String, String> 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 = ""; String sql = "";
if("MYSQL".equals(InitDBType.DBTYPE)){ if("MYSQL".equals(InitDBType.DBTYPE)){
sql += "INSERT INTO " +Tools.getTable(tcb.getContractCashTb())+ " (id," + tcb.getPlanCName() + ""; 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 +=" from "+Tools.getTable(tcb.getFundFundPlan_tb())+" fundplan " ;
sql +=" left join code_library tdd on fundplan.fee_type = tdd.itemno and tdd.codeno='FeeType' " ; 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') "; sql +=" where fundplan.flowunid = '"+ tcb.getDocId()+"' and fundplan."+tcb.getPlanCName()+"='"+tcb.getPlanCValue()+"' and fundplan.fee_type in ('feetype2','feetype1','feetype10','feetype16','feetype17','feetype33') ";
//如果是灵活产品减去产品中配置的GPS差额 //根据客户张文竹不管是否灵活产品配置的GPS差额和个人意外险差额添加到IRR计算
if("Y".equals( cb.getFlexible() ) ){ if( !"0".equals(personalInsuranceDifference) ){
Map<String, Map<String, String>> productRevenue = tcb.getProductRevenues(); 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' ";
String GPSDifference = productRevenues.get( "GPSDifference" ).get( "GPSDifference" ); }
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' "; 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)){ }else if("ORACLE".equals(InitDBType.DBTYPE)){
sql += "INSERT INTO " +Tools.getTable(tcb.getContractCashTb())+ " (id," + tcb.getPlanCName() + ""; sql += "INSERT INTO " +Tools.getTable(tcb.getContractCashTb())+ " (id," + tcb.getPlanCName() + "";
sql += ",plan_date"; sql += ",plan_date";

View File

@ -150,7 +150,7 @@ public class CreateTransactionExecutor implements Transaction {
} }
public void checkYearRate( ConditionBean cb, TabCalBean tcb, BigDecimal yearRate ) throws BusinessException { public void checkYearRate( ConditionBean cb, TabCalBean tcb, BigDecimal yearRate ) throws BusinessException {
if ( "Y".equals( cb.getFlexible() ) ) { // if ( "Y".equals( cb.getFlexible() ) ) {
// 灵活产品验证年利率区间 // 灵活产品验证年利率区间
try { try {
Map<String, Map<String, String>> productRevenues = ProductParamUtil.getProductComponentType( tcb.getProductId(), "PRD0390" ); Map<String, Map<String, String>> productRevenues = ProductParamUtil.getProductComponentType( tcb.getProductId(), "PRD0390" );
@ -164,18 +164,18 @@ public class CreateTransactionExecutor implements Transaction {
if(!(yearRate.compareTo(new BigDecimal( prodRate )) == 0) ){ if(!(yearRate.compareTo(new BigDecimal( prodRate )) == 0) ){
throw new BusinessException( "测算年利率跟产品配置的不相等,请检查!" ); throw new BusinessException( "测算年利率跟产品配置的不相等,请检查!" );
} }
} }else if("N".equals(isFixedRate)){//区间利率校验
//区间利率校验 String rateMin = productRate.get("RateTermScope-MIN");
String rateMin = productRate.get("RateTermScope-MIN"); String rateMax = productRate.get("RateTermScope-MAX");
String rateMax = productRate.get("RateTermScope-MAX"); if ( !( yearRate.compareTo( new BigDecimal( rateMax ) ) <= 0 && yearRate.compareTo( new BigDecimal( rateMin ) ) >= 0 ) ) {
if ( !( yearRate.compareTo( new BigDecimal( rateMax ) ) <= 0 && yearRate.compareTo( new BigDecimal( rateMin ) ) >= 0 ) ) { throw new BusinessException( "年利率: " + yearRate.setScale( 6, 4 ).toString() + ",不在产品配置区间范围内" );
throw new BusinessException( "年利率: " + yearRate.setScale( 6, 4 ).toString() + ",不在产品配置区间范围内" ); }
} }
} catch ( Exception e ) { } catch ( Exception e ) {
e.printStackTrace(); e.printStackTrace();
throw new BusinessException( e.getMessage() ); throw new BusinessException( e.getMessage() );
} }
} // }
} }
/** /**