package com.tenwa.reckon.adjustInterest.service.impl; import java.math.BigDecimal; import com.tenwa.reckon.adjustInterest.service.TransRateService; import com.tenwa.reckon.bean.ConditionBean; import com.tenwa.reckon.bean.FundRentPlanBean; import com.tenwa.reckon.bean.InterContBean; import com.tenwa.reckon.bean.TabCalBean; import com.tenwa.reckon.constant.Scale; import com.tenwa.reckon.util.TransRateHelper; /** * @author MHY QQ:648020894 */ public class PmtNextDayServiceImpl implements TransRateService { /** * * ( 次日调息理类) * * @param cb * 原商务条件 * @param icb * 调整计划信息 * @param tcb * 需要操作哪些表 * @return * @throws Exception */ public void processPmtTranRate(ConditionBean cb, FundRentPlanBean oldRentPlanContext, InterContBean icb,TabCalBean tcb) throws Exception { // 开始调息期数 int startList = icb.getStartList(); // 处理第一期的利息增量 BigDecimal newAddInterest = TransRateHelper.calFirstNewAddInterest(cb, oldRentPlanContext, icb,tcb); // 当期利息刷新加上变化的利息 String transFirstInterest = oldRentPlanContext.getColumn_2().get(startList - 1); transFirstInterest = new BigDecimal(transFirstInterest).add(newAddInterest).setScale(Scale.INTEREST_SCALE, BigDecimal.ROUND_HALF_UP).toString(); String transFirstCorpus = oldRentPlanContext.getColumn_1().get(startList - 1); String transFirstRent = new BigDecimal(transFirstCorpus).add(new BigDecimal(transFirstInterest)).toString(); // 赋值给租金计划 oldRentPlanContext.getRentList().set(startList - 1, transFirstRent); oldRentPlanContext.getColumn_2().set(startList - 1, transFirstInterest); oldRentPlanContext.getInterestBusinessList().set(startList - 1,new BigDecimal(oldRentPlanContext.getInterestBusinessList().get(startList - 1)).add(newAddInterest).toString()); oldRentPlanContext.getYearRateList().set(startList - 1, icb.getNewYearRate()); // 加一期调用次期的算法 int newStartList = icb.getStartList() + 1; icb.setStartList(newStartList); processPmtTranRateNextList(cb, oldRentPlanContext, icb,tcb); icb.setStartList(startList);// 还原开始日期 } /** * 调次期的方法调息 */ private void processPmtTranRateNextList(ConditionBean cb, FundRentPlanBean oldRentPlanContext, InterContBean icb,TabCalBean tcb) throws Exception { PmtNextListServiceImpl tranRateService = new PmtNextListServiceImpl(); tranRateService.processPmtTranRate(cb, oldRentPlanContext, icb,tcb); } }