diff --git a/calc/com/tenwa/reckon/executor/FundFundPlanExecutor.java b/calc/com/tenwa/reckon/executor/FundFundPlanExecutor.java index fa7cdbd8f..f93fb37ec 100644 --- a/calc/com/tenwa/reckon/executor/FundFundPlanExecutor.java +++ b/calc/com/tenwa/reckon/executor/FundFundPlanExecutor.java @@ -34,7 +34,11 @@ public class FundFundPlanExecutor { cb.setDocId(tcb.getDocId()); List fundPlanBeans=new ArrayList(); if(Double.parseDouble(cb.getCautionDeductionMoney()) > 0 ){ - fundPlanBeans = splitFundFundPlan(rentPlan, cb, "", "feetype17","feetype16"); + if(!"business_product".equals(tcb.getProductType())) { + fundPlanBeans = splitFundFundPlanList(rentPlan, cb, "", "feetype17","feetype16"); + } else { + fundPlanBeans = splitFundFundPlan(rentPlan, cb, "", "feetype17","feetype16"); + } }else{ cb.setDeductionLastPlanDate(cb.getLastPlanDate());//不生成保证金抵扣及退还计划 } @@ -319,8 +323,68 @@ 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(); + List newFundPlans = new ArrayList(); + if(Double.parseDouble(cb.getCautionMoneyRemain()) > 0){//退还保证金 + FundPlanBean newFundPlan=new FundPlanBean(); + newFundPlan.setFeeType(remainType); + newFundPlan.setPlanList("1"); + newFundPlan.setSettleMethod("payfund6"); + newFundPlan.setPayType("pay_type_out"); + newFundPlan.setPlanMoney(cb.getCautionMoneyRemain()); + newFundPlan.setPlanDate(cb.getEndDate()); + newFundPlan.setPayCust(custID); + newFundPlans.add(newFundPlan); + } + if(Double.parseDouble(cb.getCautionDeductionMoney()) > 0){//抵扣保证金 + BigDecimal planMoney=new BigDecimal(cb.getCautionDeductionMoney()); + int planList=0; + for(int i = planDates.size()-1 ; i >= 0 ; i--){ + planList++; + BigDecimal rent=new BigDecimal(rentPlans.get(i)); + if(rent.compareTo(BigDecimal.ZERO)<=0){ + continue; + } + if(planMoney.compareTo(BigDecimal.ZERO)<=0){ + cb.setDeductionLastPlanDate(planDates.get(i-1)); + break; + } + if(planMoney.compareTo(rent)>=0){ + planMoney=planMoney.subtract(rent); + FundPlanBean newFundPlan=new FundPlanBean(); + newFundPlan.setFeeType(reduceType); + newFundPlan.setPlanList(planList+""); + newFundPlan.setSettleMethod("payfund6"); + newFundPlan.setPayType("pay_type_out"); + newFundPlan.setPlanMoney(rent.toString()); + newFundPlan.setPlanDate(planDates.get(i)); + newFundPlan.setPayCust(custID); + newFundPlans.add(newFundPlan); + }else{ + FundPlanBean newFundPlan=new FundPlanBean(); + newFundPlan.setFeeType(reduceType); + newFundPlan.setPlanList(planList+""); + newFundPlan.setSettleMethod("payfund6"); + newFundPlan.setPayType("pay_type_out"); + newFundPlan.setPlanMoney(planMoney.toString()); + newFundPlan.setPlanDate(planDates.get(i)); + newFundPlan.setPayCust(custID); + newFundPlans.add(newFundPlan); + cb.setDeductionLastPlanDate(planDates.get(i)); + break; + } + } + }else{ + cb.setDeductionLastPlanDate(cb.getLastPlanDate()); + } + return newFundPlans; + } + //生成抵扣保证金 保证金退还 资金计划 - private static List splitFundFundPlan(FundRentPlanBean planBean,ConditionBean cb,String custID,String remainType,String reduceType) throws Exception{ + private static List splitFundFundPlanList(FundRentPlanBean planBean,ConditionBean cb,String custID,String remainType,String reduceType) throws Exception{ List planDates = planBean.getPlanDateList(); List rentPlans = planBean.getRentList(); //安鹏逻辑,只抵最后一期租金