|
|
|
@@ -517,21 +517,20 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService |
|
|
|
} |
|
|
|
|
|
|
|
List<BillTimeVo> billTimeVoList = WxRentContractServiceImpl.initBillTimeList(wxPropertyContract.getRentalStartDate(),wxPropertyContract.getRentalEndDate(),wxPropertyContract.getAdjustPeriod(),dayType,receivePeriod); |
|
|
|
|
|
|
|
int index = 0; |
|
|
|
for (BillTimeVo billTimeVo : billTimeVoList){ |
|
|
|
if(sd.format(billTimeVo.getStartDate()).equals("2020-05-29")){ |
|
|
|
System.out.println(); |
|
|
|
} |
|
|
|
for (int i = 0; i < billTimeVoList.size(); i++) { |
|
|
|
BillTimeVo billTimeVo = billTimeVoList.get(i); |
|
|
|
|
|
|
|
if(yearList.size() > 1) { |
|
|
|
if (endDate!=null && (sd.format(billTimeVo.getStartDate()).equals(sd.format(endDate)) || billTimeVo.getStartDate().after(endDate))) { |
|
|
|
if (endDate!=null && (sd.format(billTimeVo.getStartDate()).equals(sd.format(endDate)) || billTimeVo.getStartDate().after(endDate) || billTimeVo.getEndDate().after(endDate) )) { |
|
|
|
logger.info("=====billTimeVo.getStartDate():"+sd.format(billTimeVo.getStartDate())+" endDate:"+sd.format(endDate)); |
|
|
|
|
|
|
|
index++; |
|
|
|
if(index >= yearList.size()-1){ |
|
|
|
//endDate = wxPropertyContract.getRentalEndDate(); |
|
|
|
//endDate = wxRentContract.getRentalEndDate(); |
|
|
|
endDate = null; |
|
|
|
}else { |
|
|
|
}else{ |
|
|
|
endDate = yearList.get(index+1);//price index 0开始,year.end 从第二年开始 |
|
|
|
logger.info("==========cross:"+sd.format(endDate)); |
|
|
|
} |
|
|
|
@@ -551,7 +550,6 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService |
|
|
|
wxBillProperty.setReceiveDate(billTimeVo.getReceiveDate()); |
|
|
|
|
|
|
|
long needpay; |
|
|
|
|
|
|
|
//按日 |
|
|
|
if (wxPropertyContract.getPriceUnit().equals(EnumPriceUnit.D.getCode())){ |
|
|
|
Double priceD = new Double(price); |
|
|
|
@@ -564,15 +562,19 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService |
|
|
|
priceD = new Double(price)/12; |
|
|
|
} |
|
|
|
|
|
|
|
//当天也算,加1天 |
|
|
|
Date newEndDate = DateUtils.getDaySet(wxBillProperty.getEndtime(),Calendar.DATE,1); |
|
|
|
//按月 |
|
|
|
int[] diff = DateUtils.getDiff(wxBillProperty.getStarttime(),newEndDate); |
|
|
|
needpay =new Double( diff[0]*priceD).longValue(); |
|
|
|
|
|
|
|
double oneDayProce = priceD/DateUtils.getMonthDayCount(wxPropertyContract.getRentalEndDate()); |
|
|
|
needpay += diff[1] * oneDayProce; |
|
|
|
if(i == 0){//第一期 |
|
|
|
if(wxPropertyContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode())){ |
|
|
|
needpay = new Double(WxRentContractServiceImpl.getMonthNeedPay(priceD,billTimeVo.getStartDate(),billTimeVo.getEndDate())).longValue(); |
|
|
|
}else{ |
|
|
|
needpay = new Double(receivePeriod * priceD).longValue(); |
|
|
|
} |
|
|
|
}else if(i == billTimeVoList.size()-1){//最后 |
|
|
|
needpay = new Double(WxRentContractServiceImpl.getMonthNeedPay(priceD,billTimeVo.getStartDate(),billTimeVo.getEndDate())).longValue(); |
|
|
|
}else{//中间 |
|
|
|
needpay = new Double(receivePeriod * priceD).longValue(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
wxBillProperty.setNeedPay(needpay); |
|
|
|
wxBillProperty.setOwe(needpay); |
|
|
|
wxBillProperty.setReceivePay(needpay); |
|
|
|
|