package com.tenwa.reckon.executor; import java.util.ArrayList; import java.util.List; 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 EvenInterestExecutor extends FundRentPlanExecutor { public EvenInterestExecutor(JBOTransaction tx) { super(tx); // TODO Auto-generated constructor stub } @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); 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) throws Exception { PlanDateServiceImpl pdsi= new PlanDateServiceImpl(tx); //先找到总本金值 String leaseMoney = cb.getCleanLeaseMoney(); List interest = new InterestCalServiceImpl().getInterestList(leaseMoney, cb.getLeaseTerm(), cb.getIncomeNumber() + cb.getGrace(), cb.getEquipEndValue(), cb.getYearRate()); List corpus = null; /*if("one_1".equals(cb.getCorpusType())){//按月付息一次还本 corpus = new CorpusServiceImpl().getCorpusListForOne(cb.getCleanLeaseMoney(), cb.getIncomeNumber(), cb.getEquipEndValue(), cb.getGrace()); }else if("three_1".equals(cb.getCorpusType())){//按月付息按季还本 corpus = new CorpusServiceImpl().getCorpusListForThree(cb.getCleanLeaseMoney(), cb.getIncomeNumber(), cb.getEquipEndValue(), cb.getGrace()); }else{*/ corpus = new CorpusServiceImpl().getCorpusListFinalPayment(cb, cb.getCleanLeaseMoney(), cb.getIncomeNumber(), cb.getEquipEndValue(), cb.getGrace()); //} 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 { frpb.setInterestBusinessList(frpb.getColumn_2()); frpb.setCorpusBusinessList(frpb.getColumn_1()); // 加载调整信息列表 RentPlanServiceImpl rpsi = new RentPlanServiceImpl(); rpsi.adjustLastRentPlan(frpb, cb.getCleanLeaseMoney(), cb.getEquipEndValue()); // 加载本金余额列表 frpb.setCorpusOverageBusinessList(TransRateHelper.getCorpusOvergeList(cb.getCleanLeaseMoney(), frpb.getCorpusBusinessList())); } }