diff --git a/calc/com/tenwa/reckon/executor/FundFundPlanExecutor.java b/calc/com/tenwa/reckon/executor/FundFundPlanExecutor.java index 747a7567b..dbac9da29 100644 --- a/calc/com/tenwa/reckon/executor/FundFundPlanExecutor.java +++ b/calc/com/tenwa/reckon/executor/FundFundPlanExecutor.java @@ -32,7 +32,7 @@ public class FundFundPlanExecutor { public void run(ConditionBean cb , TabCalBean tcb,FundRentPlanBean rentPlan,JBOTransaction tx) throws Exception{ cb.setDocId(tcb.getDocId()); List fundPlanBeans=new ArrayList(); - if(Double.parseDouble(cb.getCautionMoney()) > 0 ){ + if(Double.parseDouble(cb.getCautionDeductionMoney()) > 0 ){ fundPlanBeans = splitFundFundPlan(rentPlan, cb, "", "feetype17","feetype16"); }else{ cb.setDeductionLastPlanDate(cb.getLastPlanDate());//不生成保证金抵扣及退还计划 @@ -209,6 +209,13 @@ public class FundFundPlanExecutor { private static List splitFundFundPlan(FundRentPlanBean planBean,ConditionBean cb,String custID,String remainType,String reduceType) throws Exception{ List planDates = planBean.getPlanDateList(); List rentPlans = planBean.getRentList(); + //安鹏逻辑,只抵最后一期租金 + BigDecimal lastRent = new BigDecimal(rentPlans.get(rentPlans.size() - 1)); + BigDecimal cautionMoneyDeduction = new BigDecimal(cb.getCautionDeductionMoney()); + if(lastRent.compareTo(cautionMoneyDeduction) < 0) { + cb.setCautionMoneyRemain(cautionMoneyDeduction.subtract(lastRent).toString()); + cb.setCautionDeductionMoney(lastRent.toString()); + } List newFundPlans = new ArrayList(); if(Double.parseDouble(cb.getCautionMoneyRemain()) > 0){//退还保证金 FundPlanBean newFundPlan=new FundPlanBean(); @@ -223,7 +230,16 @@ public class FundFundPlanExecutor { } if(Double.parseDouble(cb.getCautionDeductionMoney()) > 0){//抵扣保证金 BigDecimal planMoney=new BigDecimal(cb.getCautionDeductionMoney()); - int planList=0; + FundPlanBean newFundPlan=new FundPlanBean(); + newFundPlan.setFeeType(reduceType); + newFundPlan.setPlanList("1"); + newFundPlan.setSettleMethod("payfund6"); + newFundPlan.setPayType("pay_type_out"); + newFundPlan.setPlanMoney(planMoney.toString()); + newFundPlan.setPlanDate(planDates.get(planDates.size() - 1)); + newFundPlan.setPayCust(custID); + newFundPlans.add(newFundPlan); + /*int planList=0; for(int i = planDates.size()-1 ; i >= 0 ; i--){ planList++; BigDecimal rent=new BigDecimal(rentPlans.get(i)); @@ -258,7 +274,7 @@ public class FundFundPlanExecutor { cb.setDeductionLastPlanDate(planDates.get(i)); break; } - } + }*/ }else{ cb.setDeductionLastPlanDate(cb.getLastPlanDate()); } diff --git a/calc/com/tenwa/reckon/help/ConditionHelper.java b/calc/com/tenwa/reckon/help/ConditionHelper.java index 890c0e44e..eaceefc20 100644 --- a/calc/com/tenwa/reckon/help/ConditionHelper.java +++ b/calc/com/tenwa/reckon/help/ConditionHelper.java @@ -81,6 +81,10 @@ public class ConditionHelper { params.put("income_number", cb.getIncomeNumber() + ""); params.put("lease_term", cb.getLeaseTerm()+""); params.put("FIRST_PAYMENT_TOTAL",cb.getFirstPaymentTotal()); + + //更新保证金抵扣 + params.put("CAUTION_DEDUCTION_MONEY",cb.getCautionDeductionMoney()); + params.put("CAUTION_MONEY_REMAIN",cb.getCautionMoneyRemain()); this.updateCondition(bean, params); return params; }