修改保证金抵扣逻辑

This commit is contained in:
zhulianghua 2018-09-18 16:54:32 +08:00
parent 0bab10a6b3
commit 13dbedaa64

View File

@ -34,7 +34,11 @@ public class FundFundPlanExecutor {
cb.setDocId(tcb.getDocId());
List<FundPlanBean> fundPlanBeans=new ArrayList<FundPlanBean>();
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<FundPlanBean> splitFundFundPlan(FundRentPlanBean planBean,ConditionBean cb,String custID,String remainType,String reduceType) throws Exception{
List<String> planDates = planBean.getPlanDateList();
List<String> rentPlans = planBean.getRentList();
List<FundPlanBean> newFundPlans = new ArrayList<FundPlanBean>();
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<FundPlanBean> splitFundFundPlan(FundRentPlanBean planBean,ConditionBean cb,String custID,String remainType,String reduceType) throws Exception{
private static List<FundPlanBean> splitFundFundPlanList(FundRentPlanBean planBean,ConditionBean cb,String custID,String remainType,String reduceType) throws Exception{
List<String> planDates = planBean.getPlanDateList();
List<String> rentPlans = planBean.getRentList();
//安鹏逻辑只抵最后一期租金