分段融修改

This commit is contained in:
yjf 2021-12-09 17:49:53 +08:00
parent ab070845db
commit c855e8926f
3 changed files with 25 additions and 19 deletions

View File

@ -74,7 +74,7 @@
var subsectionConfig = parent.getItemValue( 0, 0, 'SUBSECTION_CONDIG' );
var equipAmt = parent.getItemValue( 0, 0, 'EQUIP_AMT' );
var cleanLeaseMoney = parent.getItemValue( 0, 0, 'CLEAN_LEASE_MONEY' );
var cleanLeaseRatio = getItemValue( 0, getRow(), 'CLEAN_LEASE_RATIO' );
var cleanLeaseRatio = getItemValue( 0, this.id.replace(/[^\d]/g,'').substr(1,1), 'CLEAN_LEASE_RATIO' );
if ( subsectionConfig ) {
var fcleanLeaseMoney ;
if ( 'CarPrice' === subsectionConfig ) {
@ -82,17 +82,17 @@
} else {
fcleanLeaseMoney = Decimal( cleanLeaseMoney ).mul( cleanLeaseRatio ).div( 100 ).toFixed( 2 )
}
var maxLeaseMoney = getItemValue( 0, getRow(), 'MAX_LEASE_MONEY' ) ;
var minLeaseMoney = getItemValue( 0, getRow(), 'MIN_LEASE_MONEY' );
var maxLeaseMoney = getItemValue( 0,this.id.replace(/[^\d]/g,'').substr(1,1), 'MAX_LEASE_MONEY' ) ;
var minLeaseMoney = getItemValue( 0,this.id.replace(/[^\d]/g,'').substr(1,1), 'MIN_LEASE_MONEY' );
if(typeof(fcleanLeaseMoney)!="undefined" && fcleanLeaseMoney.length!=0 && (Number(fcleanLeaseMoney) > Number(maxLeaseMoney) || Number(fcleanLeaseMoney) < Number(minLeaseMoney))){
setItemValue( 0, getRow(), 'CLEAN_LEASE_MONEY', '');
setItemValue( 0, getRow(), 'CLEAN_LEASE_RATIO', '');
setItemValue( 0, this.id.replace(/[^\d]/g,'').substr(1,1), 'CLEAN_LEASE_MONEY', '');
setItemValue( 0, this.id.replace(/[^\d]/g,'').substr(1,1), 'CLEAN_LEASE_RATIO', '');
alert("该段的融资金额不在产品配置的区间内,请检查!");
return
}
setItemValue( 0, getRow(), 'CLEAN_LEASE_MONEY', fcleanLeaseMoney);
setItemValue( 0, this.id.replace(/[^\d]/g,'').substr(1,1), 'CLEAN_LEASE_MONEY', fcleanLeaseMoney);
} else {
setItemValue( 0, getRow(), 'CLEAN_LEASE_MONEY', '' );
setItemValue( 0, this.id.replace(/[^\d]/g,'').substr(1,1), 'CLEAN_LEASE_MONEY', '' );
}
}
@ -121,20 +121,24 @@
}
function save() {
let subsectionConfig = parent.getItemValue( 0, 0, 'SUBSECTION_CONDIG' );
if (!subsectionConfig) {
alert('请选择分段配置');
return;
}
var rowCount = getRowCount( 0 );
// var allRatio = Decimal( 0 );
var clmCheck = Decimal( 0 );
for ( var i = 0; i < rowCount; i ++ ) {
// var cleanLeaseRatio = getItemValue( 0, i, 'CLEAN_LEASE_RATIO' );
var cleanLeaseRatio = getItemValue( 0, i, 'CLEAN_LEASE_RATIO' );
if(!cleanLeaseRatio ){
alert( '第' + ( i + 1 ) + '行融资额比例为空,请检查!' );
return;
}
var cleanLeaseMoney = getItemValue( 0, i, 'CLEAN_LEASE_MONEY' );
if ( cleanLeaseMoney ) {
clmCheck = clmCheck.add( cleanLeaseMoney );
}
if ( '' === cleanLeaseMoney ) {
alert( 'ÇëÑ¡Ôñ·Ö¶ÎÅäÖÃ' );
return;
}
var discountCalcMethod = getItemValue( 0, i, 'DISCOUNT_CALC_METHOD' );
if ( '2' === discountCalcMethod ) {
var discount = getItemValue( 0, i, 'DISCOUNT_INTEREST' );

View File

@ -771,6 +771,12 @@ public class CreateTransactionExecutor implements Transaction {
ConditionHelper helper = new ConditionHelper();
helper.setTx(tx);
helper.run(jsonObject, cb, bean, rentPlan,flag);
String settleMethod = bean.getCb().getSettleMethod();
//更新商务条件表贴息字段--分段融
if("segmented_financing".equals(settleMethod)){
com.amarsoft.awe.util.Transaction.createTransaction(tx).executeSQL("update lc_calc_condition_temp lcct set lcct.DISCOUNT_INTEREST = (select sum(ifnull(DISCOUNT_INTEREST, 0)) from lc_calc_subsection_info_temp lcsit where lcct.FLOWUNID = lcsit.FLOWUNID) where lcct.FLOWUNID = '"+bean.getDocId()+"'");
}
}

View File

@ -84,17 +84,13 @@ public class SegmentedFinancingExecutor extends FundRentPlanExecutor {
}else {
bo.setAttributeValue( "DISCOUNT_INTEREST", discount );
}
String fr = bo.getAttribute( "FINANCING_RATE" ).getString();
if ( StringUtils.isEmpty( fr ) || ( iulma!=null && "Y".equals(iulma) ) ) {
financingRate = discountRate;
bo.setAttributeValue( "FINANCING_RATE", discountRate.multiply( new BigDecimal( 100 ) ).toString() );
} else {
financingRate = new BigDecimal( fr ).divide( new BigDecimal( 100 ), 20, 4 );
}
bo.setAttributeValue( tcb.getPlanCName(), tcb.getPlanCValue() );
bom.saveObject( bo );
} else if("2".equals( discountCalcMethod )) { //根据金额算利率
// 贴息金额
BigDecimal discount = new BigDecimal( bo.getAttribute( "DISCOUNT_INTEREST" ).getString() );
@ -116,13 +112,13 @@ public class SegmentedFinancingExecutor extends FundRentPlanExecutor {
} else {
financingRate = new BigDecimal( fr ).divide( new BigDecimal( 100 ), 20, 4 );
}
bo.setAttributeValue( tcb.getPlanCName(), tcb.getPlanCValue() );
bom.saveObject( bo );
}else if("3".equals( discountCalcMethod )) { // 固定值
financingRate = new BigDecimal( bo.getAttribute( "FINANCING_RATE" ).getString() ).divide( new BigDecimal( 100 ), 20, 4 );
} else {
throw new BusinessException( "分段信息没有配置计算规则,无法测算!" );
}
bo.setAttributeValue( tcb.getPlanCName(), tcb.getPlanCValue() );
bom.saveObject( bo );
//校验贴息是否在配置的区间内
BigDecimal discountCheck = new BigDecimal( bo.getAttribute( "DISCOUNT_INTEREST" ).getString() );
if(discountCheck.compareTo( new BigDecimal( bo.getAttribute( "MAXIMUM_DISCOUNT" ).getString() ) ) < 0) {