|
|
@@ -119,7 +119,9 @@ public class WxRentContractServiceImpl implements WxRentContractService { |
|
|
|
|
|
|
|
|
//init dateDiff |
|
|
//init dateDiff |
|
|
if(wxRentContract.getRentalStartDate() != null && wxRentContract.getRentalEndDate() != null){ |
|
|
if(wxRentContract.getRentalStartDate() != null && wxRentContract.getRentalEndDate() != null){ |
|
|
int[] array = DateUtils.getDiff(wxRentContract.getRentalStartDate(),wxRentContract.getRentalEndDate()); |
|
|
|
|
|
|
|
|
//加1天 |
|
|
|
|
|
Date newEndDate = DateUtils.getDaySet(wxRentContract.getRentalEndDate(),Calendar.DATE,1); |
|
|
|
|
|
int[] array = DateUtils.getDiff(wxRentContract.getRentalStartDate(),newEndDate); |
|
|
result.put("totalPeriodMonth",array[0]); |
|
|
result.put("totalPeriodMonth",array[0]); |
|
|
result.put("totalPeriodDay",array[1]); |
|
|
result.put("totalPeriodDay",array[1]); |
|
|
} |
|
|
} |
|
|
@@ -929,16 +931,19 @@ public class WxRentContractServiceImpl implements WxRentContractService { |
|
|
|
|
|
|
|
|
long needpay; |
|
|
long needpay; |
|
|
|
|
|
|
|
|
//当天也算,加1天 |
|
|
|
|
|
//Date newEndDate = DateUtils.getDaySet(wxBillRent.getEndtime(),Calendar.DATE,1); |
|
|
|
|
|
//按日 |
|
|
//按日 |
|
|
if(wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_DAY.getCode())){ |
|
|
if(wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_DAY.getCode())){ |
|
|
double needpayD = this.getNeedPay(0,price,wxBillRent.getStarttime(),wxBillRent.getEndtime()); |
|
|
|
|
|
|
|
|
double needpayD = WxRentContractServiceImpl.getNeedPay(0,price,wxBillRent.getStarttime(),wxBillRent.getEndtime()); |
|
|
needpay = new Double(needpayD).longValue(); |
|
|
needpay = new Double(needpayD).longValue(); |
|
|
}else{ |
|
|
}else{ |
|
|
|
|
|
//当天也算,加1天 |
|
|
|
|
|
Date newEndDate = DateUtils.getDaySet(wxBillRent.getEndtime(),Calendar.DATE,1); |
|
|
//按月 |
|
|
//按月 |
|
|
double needpayD = this.getNeedPay(price,0,wxBillRent.getStarttime(),wxBillRent.getEndtime()); |
|
|
|
|
|
needpay = new Double(needpayD).longValue(); |
|
|
|
|
|
|
|
|
int[] diff = DateUtils.getDiff(wxBillRent.getStarttime(),newEndDate); |
|
|
|
|
|
needpay = diff[0]*price; |
|
|
|
|
|
|
|
|
|
|
|
double oneDayProce = (double) price/DateUtils.getMonthDayCount(wxRentContract.getRentalEndDate()); |
|
|
|
|
|
needpay += diff[1] * oneDayProce; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
wxBillRent.setNeedPay(needpay); |
|
|
wxBillRent.setNeedPay(needpay); |
|
|
@@ -1742,7 +1747,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { |
|
|
public static double getNeedPay(long monthPrice,long dayPrice,Date start,Date end){ |
|
|
public static double getNeedPay(long monthPrice,long dayPrice,Date start,Date end){ |
|
|
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
SimpleDateFormat sdM = new SimpleDateFormat("MM"); |
|
|
SimpleDateFormat sdM = new SimpleDateFormat("MM"); |
|
|
Double total; |
|
|
|
|
|
|
|
|
Double total = new Double(0); |
|
|
|
|
|
int[] diff; |
|
|
|
|
|
|
|
|
int dayCount = DateUtils.getMonthDayCount(start); |
|
|
int dayCount = DateUtils.getMonthDayCount(start); |
|
|
double price; |
|
|
double price; |
|
|
@@ -1752,11 +1758,17 @@ public class WxRentContractServiceImpl implements WxRentContractService { |
|
|
price = dayPrice; |
|
|
price = dayPrice; |
|
|
} |
|
|
} |
|
|
Date currEnd = DateUtils.getLastDayForMonth(start); |
|
|
Date currEnd = DateUtils.getLastDayForMonth(start); |
|
|
int[] diff = DateUtils.getDiff(start,currEnd); |
|
|
|
|
|
total = (diff[1]+1) * price; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("-----------"); |
|
|
|
|
|
System.out.println(sd.format(start)); |
|
|
|
|
|
System.out.println(sd.format(currEnd)); |
|
|
|
|
|
|
|
|
if(sdM.format(start).equals(sdM.format(end))){ |
|
|
if(sdM.format(start).equals(sdM.format(end))){ |
|
|
|
|
|
total = 1 * price; //算1天 |
|
|
return total; |
|
|
return total; |
|
|
|
|
|
}else{ |
|
|
|
|
|
diff = DateUtils.getDiff(start,currEnd); |
|
|
|
|
|
total = (diff[1]+1) * price; |
|
|
} |
|
|
} |
|
|
System.out.println("-------total:"+total); |
|
|
System.out.println("-------total:"+total); |
|
|
|
|
|
|
|
|
|