From 638ad6892afc1e18a1e431ba9f5ab3620d36b5e0 Mon Sep 17 00:00:00 2001 From: tangfutang <3218982385@qq.com> Date: Wed, 24 Nov 2021 11:31:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B4=B4=E6=81=AF=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=E5=92=8C=E7=A7=9F=E9=87=91=E8=AE=A1=E5=88=92=E8=BF=98?= =?UTF-8?q?=E6=AC=BE=E6=97=A5=E7=9A=84=E9=BB=98=E8=AE=A4=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../executor/CreateTransactionExecutor.java | 6 ++--- .../executor/SegmentedFinancingExecutor.java | 25 +++++++++++++++---- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/calc/com/tenwa/reckon/executor/CreateTransactionExecutor.java b/calc/com/tenwa/reckon/executor/CreateTransactionExecutor.java index f9b4ff979..6c81c0fa4 100644 --- a/calc/com/tenwa/reckon/executor/CreateTransactionExecutor.java +++ b/calc/com/tenwa/reckon/executor/CreateTransactionExecutor.java @@ -330,10 +330,10 @@ public class CreateTransactionExecutor implements Transaction { if("ZC".equals(channel)){ planDateList = getPlanDateListZC(incomeNumber, incomeIntervalMonth, startDate); }else{ - if("02".equals(defaultDueDay)) { - planDateList = getPlanDateListFixed(incomeNumber, periodType, incomeIntervalMonth, startDate); - } else { + if("01".equals(defaultDueDay)) { planDateList = getPlanDateList(incomeNumber, periodType, incomeIntervalMonth, startDate); + } else { + planDateList = getPlanDateListFixed(incomeNumber, periodType, incomeIntervalMonth, startDate); } } diff --git a/calc/com/tenwa/reckon/executor/SegmentedFinancingExecutor.java b/calc/com/tenwa/reckon/executor/SegmentedFinancingExecutor.java index bb9d3d89f..68c431f2a 100644 --- a/calc/com/tenwa/reckon/executor/SegmentedFinancingExecutor.java +++ b/calc/com/tenwa/reckon/executor/SegmentedFinancingExecutor.java @@ -76,13 +76,20 @@ public class SegmentedFinancingExecutor extends FundRentPlanExecutor { 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_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(); if ( StringUtils.isEmpty( fr ) || ( iulma!=null && "Y".equals(iulma) ) ) { - financingRate = discountRate.divide( new BigDecimal( 100 ), 20, 4 ); - bo.setAttributeValue( "FINANCING_RATE", discountRate.toString() ); + financingRate = discountRate; + bo.setAttributeValue( "FINANCING_RATE", discountRate.multiply( new BigDecimal( 100 ) ).toString() ); } else { 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() ); - 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+"段的贴息金额不在产品配置的区间内!" ); + if(discountCheck.compareTo( new BigDecimal( bo.getAttribute( "MAXIMUM_DISCOUNT" ).getString() ) ) < 0) { + } + + /* 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 ); @@ -220,4 +231,8 @@ public class SegmentedFinancingExecutor extends FundRentPlanExecutor { return irr; } + public static void main(String[] args) { + System.out.println(new BigDecimal("12709.80").compareTo(new BigDecimal("10000.00"))); + + } }