apzl_leasing/calc/com/tenwa/reckon/executor/EvenRentExecutor.java
2018-09-17 13:26:00 +08:00

112 lines
4.0 KiB
Java

package com.tenwa.reckon.executor;
import java.math.BigDecimal;
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.constant.Scale;
import com.tenwa.reckon.help.CorpusServiceImpl;
import com.tenwa.reckon.help.InterestCalServiceImpl;
import com.tenwa.reckon.help.KnowingRentTools;
import com.tenwa.reckon.help.PlanDateServiceImpl;
import com.tenwa.reckon.help.RentPlanServiceImpl;
import com.tenwa.reckon.help.RentalServiceImpl;
import com.tenwa.reckon.util.RateTools;
import com.tenwa.reckon.util.TransRateHelper;
public class EvenRentExecutor extends FundRentPlanExecutor {
public EvenRentExecutor(JBOTransaction tx) {
super(tx);
}
@Override
public FundRentPlanBean create(TabCalBean tcb,Integer startList) throws Exception {
FundRentPlanBean fpb = new FundRentPlanBean();
//ɾ³ý×â½ð¼Æ»®
this.deleteRentPlan(tcb.getRentPlan_tb(), tcb, startList);
this.getPmtRentPlan(tcb.getCb(), fpb,tcb);
this.addRentPlan(fpb, tcb, startList);
return fpb;
}
public void getPmtRentPlan(ConditionBean cb, FundRentPlanBean frpb,TabCalBean tcb) throws Exception {
List<String> rentList = new ArrayList<String>();
// ¼ÓÔØ×â½ðÁбí
if(cb.getRentOrRate().equals("knowing_rent")){
Integer grace = cb.getGrace();
if(grace > 0){
String preRate = RateTools.getPreRate(new BigDecimal(cb.getYearRate()).setScale(6,BigDecimal.ROUND_HALF_UP).toString(), cb.getIncomeNumberYear(),cb.getRateAdjustType());
String tempRent = new BigDecimal(cb.getCleanLeaseMoney()).multiply(new BigDecimal(preRate)).setScale(Scale.RENT_SCALE, BigDecimal.ROUND_HALF_UP).toString();
for(int i = 0 ; i < grace ; i++){
rentList.add(tempRent);
}
}
rentList.addAll(KnowingRentTools.convertKnowingBeanToStrList(tcb.getKnowingConfigs()));
}else{
RentalServiceImpl rsi = new RentalServiceImpl();
rentList = rsi.getRentListByCond(cb);
}
frpb.setRentList(rentList);
// ¼ÓÔØÈÕÆÚÁбí
PlanDateServiceImpl pdsi = new PlanDateServiceImpl(tx);
List<String> dateList = pdsi.getPlanDateList(cb, String.valueOf(frpb.getRentList().size()));
List<String> interestDateList=pdsi.getInterestDateList(cb);
//½Ú¼ÙÈÕµ÷Õû
//°²Åô²âËã²»×ö½Ú¼ÙÈÕµ÷Õû by zhulh 2018/09/17
//dateList=pdsi.getAdjustDate(dateList,cb.getPlanDateHoilday());
interestDateList=pdsi.getAdjustDate(interestDateList, cb.getInterestDateHoliday());
if("start_date".equals(cb.getInterestDayType())){
interestDateList=dateList;
}
frpb.setPlanDateList(dateList);
frpb.setInterestDateList(interestDateList);
List<String> year_rate = new ArrayList<String>();
for (int i = 0; i < frpb.getPlanDateList().size(); i++) {
year_rate.add(cb.getYearRate());
}
frpb.setYearRateList(year_rate);
// ¼ÓÔØÀûÏ¢Áбí
InterestCalServiceImpl icsi = new InterestCalServiceImpl();
List<String> interests = icsi.getInterestList(frpb.getRentList(), cb.getCleanLeaseMoney(), cb.getYearRate(), cb.getPeriodType(), cb.getGrace(), cb.getIncomeNumberYear(), cb.getEquipEndValue(),cb.getRateAdjustType());
frpb.setInterestBusinessList(interests);
// ¼ÓÔØ±¾½ðÁбí
CorpusServiceImpl csi = new CorpusServiceImpl();
List<String> corpusList = csi.getCorpusList(frpb.getRentList(), frpb.getInterestBusinessList());
frpb.setCorpusBusinessList(corpusList);
//¼ÆË㺬˰×â½ð
if(tcb.getCb().getSettleMethod().equals("even_rent_rate")){
this.addRentRate(tcb.getCb(), frpb);
}
// ¼ÓÔØµ÷ÕûÐÅÏ¢Áбí
RentPlanServiceImpl rpsi = new RentPlanServiceImpl();
rpsi.adjustLastRentPlan(frpb, cb.getCleanLeaseMoney(), cb.getEquipEndValue());
if("rate".equals(cb.getRentOrRate())){
rpsi.adjustFistAndLastRentPlan(frpb, tcb);
}
// ¼ÓÔØ±¾½ðÓà¶îÁбí
List<String> corpusOverageBusinessList = TransRateHelper.getCorpusOvergeList(cb.getCleanLeaseMoney(), frpb.getCorpusBusinessList());
frpb.setCorpusOverageBusinessList(corpusOverageBusinessList);
}
}