修改贴息校验和租金计划还款日的默认规则

This commit is contained in:
tangfutang 2021-11-24 11:31:02 +08:00
parent f9e66cf4d4
commit 638ad6892a
2 changed files with 23 additions and 8 deletions

View File

@ -330,10 +330,10 @@ public class CreateTransactionExecutor implements Transaction {
if("ZC".equals(channel)){ if("ZC".equals(channel)){
planDateList = getPlanDateListZC(incomeNumber, incomeIntervalMonth, startDate); planDateList = getPlanDateListZC(incomeNumber, incomeIntervalMonth, startDate);
}else{ }else{
if("02".equals(defaultDueDay)) { if("01".equals(defaultDueDay)) {
planDateList = getPlanDateListFixed(incomeNumber, periodType, incomeIntervalMonth, startDate);
} else {
planDateList = getPlanDateList(incomeNumber, periodType, incomeIntervalMonth, startDate); planDateList = getPlanDateList(incomeNumber, periodType, incomeIntervalMonth, startDate);
} else {
planDateList = getPlanDateListFixed(incomeNumber, periodType, incomeIntervalMonth, startDate);
} }
} }

View File

@ -76,13 +76,20 @@ public class SegmentedFinancingExecutor extends FundRentPlanExecutor {
String afterDiscountRent = RentTools.getPMT( preDiscountRate.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 ) ); BigDecimal discount = new BigDecimal( rent ).setScale( 2, 4 ).multiply( incomeNumber ).subtract( new BigDecimal( afterDiscountRent ).setScale( 2, 4 ).multiply( incomeNumber ) );
bo.setAttributeValue( "DISCOUNT_INTEREST", discount ); //客户要求如果算出的贴息比配置的大贴息金额为配置的最大金额算出的贴息金额小于配置的最小值贴息金额为配置的最小值产品利率和融资利率不做调整
if ( discount.compareTo( new BigDecimal( bo.getAttribute( "MAXIMUM_DISCOUNT" ).getString() ) ) > 0 ) {
bo.setAttributeValue( "DISCOUNT_INTEREST", bo.getAttribute( "MAXIMUM_DISCOUNT" ).getString() );
}else if ( discount.compareTo( new BigDecimal( bo.getAttribute( "MINIMUM_DISCOUNT" ).getString() ) ) < 0 ){
bo.setAttributeValue( "DISCOUNT_INTEREST", bo.getAttribute( "MINIMUM_DISCOUNT" ).getString() );
}else {
bo.setAttributeValue( "DISCOUNT_INTEREST", discount );
}
String fr = bo.getAttribute( "FINANCING_RATE" ).getString(); String fr = bo.getAttribute( "FINANCING_RATE" ).getString();
if ( StringUtils.isEmpty( fr ) || ( iulma!=null && "Y".equals(iulma) ) ) { if ( StringUtils.isEmpty( fr ) || ( iulma!=null && "Y".equals(iulma) ) ) {
financingRate = discountRate.divide( new BigDecimal( 100 ), 20, 4 ); financingRate = discountRate;
bo.setAttributeValue( "FINANCING_RATE", discountRate.toString() ); bo.setAttributeValue( "FINANCING_RATE", discountRate.multiply( new BigDecimal( 100 ) ).toString() );
} else { } else {
financingRate = new BigDecimal( fr ).divide( new BigDecimal( 100 ), 20, 4 ); financingRate = new BigDecimal( fr ).divide( new BigDecimal( 100 ), 20, 4 );
} }
@ -118,9 +125,13 @@ public class SegmentedFinancingExecutor extends FundRentPlanExecutor {
} }
//校验贴息是否在配置的区间内 //校验贴息是否在配置的区间内
BigDecimal discountCheck = new BigDecimal( bo.getAttribute( "DISCOUNT_INTEREST" ).getString() ); BigDecimal discountCheck = new BigDecimal( bo.getAttribute( "DISCOUNT_INTEREST" ).getString() );
if ( !( discountCheck.compareTo( new BigDecimal( bo.getAttribute( "MAXIMUM_DISCOUNT" ).getString() ) ) <= 0 && discountCheck.compareTo( new BigDecimal( bo.getAttribute( "MINIMUM_DISCOUNT" ).getString() ) ) >= 0 ) ) { if(discountCheck.compareTo( new BigDecimal( bo.getAttribute( "MAXIMUM_DISCOUNT" ).getString() ) ) < 0) {
throw new BusinessException( "分段融的第"+subsectionNumber+"段的贴息金额不在产品配置的区间内!" );
} }
/* if ( !( discountCheck.compareTo( new BigDecimal( bo.getAttribute( "MAXIMUM_DISCOUNT" ).getString() ) ) <= 0 && discountCheck.compareTo( new BigDecimal( bo.getAttribute( "MINIMUM_DISCOUNT" ).getString() ) ) >= 0 ) ) {
throw new BusinessException( "分段融的第"+subsectionNumber+"段的贴息金额不在产品配置的区间内!" );
}*/
// 融资期利率 // 融资期利率
BigDecimal preFinancingRate = financingRate.divide( incomeNumberYear, 20, 4 ); BigDecimal preFinancingRate = financingRate.divide( incomeNumberYear, 20, 4 );
@ -220,4 +231,8 @@ public class SegmentedFinancingExecutor extends FundRentPlanExecutor {
return irr; return irr;
} }
public static void main(String[] args) {
System.out.println(new BigDecimal("12709.80").compareTo(new BigDecimal("10000.00")));
}
} }