package com.tenwa.reckon.executor; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; import com.amarsoft.app.util.ProductParamUtil; import com.amarsoft.are.jbo.JBOTransaction; import com.tenwa.reckon.bean.ConditionBean; import com.tenwa.reckon.bean.FundRentPlanBean; import com.tenwa.reckon.bean.TabCalBean; import com.tenwa.reckon.help.CorpusServiceImpl; import com.tenwa.reckon.help.InterestCalServiceImpl; import com.tenwa.reckon.help.PlanDateServiceImpl; import com.tenwa.reckon.help.RentPlanServiceImpl; import com.tenwa.reckon.help.RentalServiceImpl; import com.tenwa.reckon.util.IrrTools; import com.tenwa.reckon.util.TransRateHelper; public class CarEvenInterestExecutor extends FundRentPlanExecutor { public CarEvenInterestExecutor(JBOTransaction tx,String productId) { super(tx); } @Override public FundRentPlanBean create(TabCalBean tcb,Integer startList) throws Exception { FundRentPlanBean fpb = new FundRentPlanBean(); ConditionBean cb = tcb.getCb(); String year_rate = cb.getYearRate(); //删除租金计划 this.deleteRentPlan(tcb.getRentPlan_tb(), tcb, startList); this.rentPlanEvenInterestCal(cb, fpb,tcb); String irr=cb.getYearRate(); cb.setCleanLeaseMoney(cb.getCleanLeaseMoney()); calFina(cb, tcb, 1, fpb);//做财务计划测算 cb.setYearRate(year_rate);//把年利率置回去 List rateList = new ArrayList(); for (int i = 0; i < fpb.getCorpusBusinessList().size(); i++) { rateList.add(irr); } fpb.setYearRateList(rateList); this.addRentPlan(fpb, tcb,startList); return fpb; } public void rentPlanEvenInterestCal(ConditionBean cb, FundRentPlanBean frpb, TabCalBean tcb) throws Exception { // PlanDateServiceImpl pdsi= new PlanDateServiceImpl(tx); // //先找到总本金值 // String leaseMoney = cb.getCleanLeaseMoney(); // initShareAndRetainage(tcb, cb);//初始化分摊本金与尾款 // List interest = new InterestCalServiceImpl().getInterestList(leaseMoney, cb.getLeaseTerm(), cb.getIncomeNumber() + cb.getGrace(), cb.getEquipEndValue(), cb.getYearRate()); // List corpus = new CorpusServiceImpl().getCorpusListWithZL(cb.getCleanLeaseMoney(), cb.getIncomeNumber(), cb.getEquipEndValue(), cb.getGrace(), cb.getShare(),cb.getRetainage()); // List rentList = new RentalServiceImpl().getRentListByCond(cb.getCleanLeaseMoney(), cb.getEquipEndValue(), corpus, interest,cb); // List dateList =pdsi.getPlanDateList(cb, String.valueOf(frpb.getRentList().size())); // List interestDateList=pdsi.getInterestDateList(cb); // // //节假日调整 // dateList=pdsi.getAdjustDate(dateList,cb.getPlanDateHoilday()); // interestDateList=pdsi.getAdjustDate(interestDateList, cb.getInterestDateHoliday()); // // if("start_date".equals(cb.getInterestDayType())){ // interestDateList=dateList; // } // // frpb.setInterestDateList(interestDateList); // frpb.setPlanDateList(dateList); // frpb.setColumn_1(corpus); // frpb.setColumn_2(interest); // frpb.setRentList(rentList); // // List rentListTemp = rentList; // List rentRemainList = new RentalServiceImpl().getRentRemainList(rentListTemp); // frpb.setAllRemainRentList(rentRemainList); // // String irr = IrrTools.getIRRByEvenInterest(cb, frpb);//获取均息法下的利率 // cb.setYearRate(irr); } public void calFina(ConditionBean cb, TabCalBean tcb, int startList, FundRentPlanBean frpb) throws Exception { // 加载利息列表 //InterestCalServiceImpl icsi = new InterestCalServiceImpl(); //List interests = icsi.getInterestList(frpb.getRentList(), cb.getCleanLeaseMoney(), cb.getYearRate(), cb.getPeriodType(), cb.getGrace(), cb.getIncomeNumberYear(), cb.getEquipEndValue(),cb.getRateAdjustType()); frpb.setInterestBusinessList(frpb.getColumn_2()); // 加载本金列表 //CorpusServiceImpl csi = new CorpusServiceImpl(); //List corpusList = csi.getCorpusList(frpb.getRentList(), frpb.getInterestBusinessList()); frpb.setCorpusBusinessList(frpb.getColumn_1()); // 加载调整信息列表 RentPlanServiceImpl rpsi = new RentPlanServiceImpl(); rpsi.adjustLastRentPlan(frpb, cb.getCleanLeaseMoney(), cb.getEquipEndValue()); // 加载本金余额列表 frpb.setCorpusOverageBusinessList(TransRateHelper.getCorpusOvergeList(cb.getCleanLeaseMoney(), frpb.getCorpusBusinessList())); } }