|
|
|
@@ -728,9 +728,6 @@ public class WxRentContractServiceImpl implements WxRentContractService { |
|
|
|
|
|
|
|
Date rentalStartDate = wxRentContract.getRentalStartDate(); |
|
|
|
Long price = wxRentContract.getPrice(); |
|
|
|
if(EnumPriceUnit.Y.getCode().equals(wxRentContract.getPriceUnit())){ |
|
|
|
price = price/12; |
|
|
|
} |
|
|
|
|
|
|
|
//按月计租 |
|
|
|
// if (wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_MONTH.getCode()) |
|
|
|
@@ -760,13 +757,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { |
|
|
|
long[] priceArr = new long[arraySize]; |
|
|
|
for (int i = 0; i < arraySize; i++) { |
|
|
|
JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); |
|
|
|
//年 需要除12 |
|
|
|
if(EnumPriceUnit.Y.getCode().equals(priceUnit)){ |
|
|
|
BigDecimal yprice = new BigDecimal(rentInfoObject.getString("price")).divide(new BigDecimal(12),2, BigDecimal.ROUND_HALF_DOWN); |
|
|
|
priceArr[i] = yprice.multiply(new BigDecimal(100)).longValue(); |
|
|
|
}else{ |
|
|
|
priceArr[i] = new BigDecimal(rentInfoObject.getString("price")).multiply(new BigDecimal(100)).longValue(); |
|
|
|
} |
|
|
|
priceArr[i] = new BigDecimal(rentInfoObject.getString("price")).multiply(new BigDecimal(100)).longValue(); |
|
|
|
} |
|
|
|
priceList.add(priceArr); |
|
|
|
//大于一年 |
|
|
|
@@ -880,7 +871,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { |
|
|
|
List<WxBillRent> resultList = new ArrayList<>(); |
|
|
|
final IdWorker idWorker = IdWorker.get(); |
|
|
|
|
|
|
|
Date endDate = null; |
|
|
|
Date endDate = null;//每年的截止日期 |
|
|
|
if(yearList.size() > 1){ |
|
|
|
endDate = yearList.get(1); |
|
|
|
} |
|
|
|
@@ -900,8 +891,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { |
|
|
|
if(index >= yearList.size()-1){ |
|
|
|
//endDate = wxRentContract.getRentalEndDate(); |
|
|
|
endDate = null; |
|
|
|
}else { |
|
|
|
endDate = yearList.get(index); |
|
|
|
}else{ |
|
|
|
endDate = yearList.get(index+1);//price index 0开始,year.end 从第二年开始 |
|
|
|
logger.info("==========cross:"+sd.format(endDate)); |
|
|
|
} |
|
|
|
|
|
|
|
@@ -946,16 +937,23 @@ public class WxRentContractServiceImpl implements WxRentContractService { |
|
|
|
|
|
|
|
//按日 |
|
|
|
if (wxRentContract.getPriceUnit().equals(EnumPriceUnit.D.getCode())){ |
|
|
|
double needpayD = WxRentContractServiceImpl.getNeedPay(0,price,wxBillRent.getStarttime(),wxBillRent.getEndtime()); |
|
|
|
Double priceD = new Double(price); |
|
|
|
double needpayD = WxRentContractServiceImpl.getNeedPay(0,priceD,wxBillRent.getStarttime(),wxBillRent.getEndtime()); |
|
|
|
needpay = new Double(needpayD).longValue(); |
|
|
|
}else{ |
|
|
|
//年 需要除12 |
|
|
|
Double priceD = new Double(price); |
|
|
|
if(EnumPriceUnit.Y.getCode().equals(wxRentContract.getPriceUnit())){ |
|
|
|
priceD = new Double(price)/12; |
|
|
|
} |
|
|
|
|
|
|
|
//当天也算,加1天 |
|
|
|
Date newEndDate = DateUtils.getDaySet(wxBillRent.getEndtime(),Calendar.DATE,1); |
|
|
|
//按月 |
|
|
|
int[] diff = DateUtils.getDiff(wxBillRent.getStarttime(),newEndDate); |
|
|
|
needpay = diff[0]*price; |
|
|
|
needpay =new Double( diff[0]*priceD).longValue(); |
|
|
|
|
|
|
|
double oneDayProce = (double) price/DateUtils.getMonthDayCount(wxRentContract.getRentalEndDate()); |
|
|
|
double oneDayProce = priceD/DateUtils.getMonthDayCount(wxRentContract.getRentalEndDate()); |
|
|
|
needpay += diff[1] * oneDayProce; |
|
|
|
} |
|
|
|
|
|
|
|
@@ -1778,7 +1776,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { |
|
|
|
* @param end |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public static double getNeedPay(long monthPrice,long dayPrice,Date start,Date end){ |
|
|
|
public static double getNeedPay(long monthPrice,Double dayPrice,Date start,Date end){ |
|
|
|
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
SimpleDateFormat sdM = new SimpleDateFormat("yyyy-MM"); |
|
|
|
Double total; |
|
|
|
@@ -1842,7 +1840,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { |
|
|
|
Date start = sd.parse("2020-05-29"); |
|
|
|
Date end = sd.parse("2020-07-28"); |
|
|
|
|
|
|
|
System.out.println("===="+new WxRentContractServiceImpl().getNeedPay(tprice,0,start,end));; |
|
|
|
// System.out.println("===="+new WxRentContractServiceImpl().getNeedPay(tprice,0,start,end));; |
|
|
|
} |
|
|
|
|
|
|
|
public static List<BillTimeVo> initBillTimeList(Date start,Date end,Integer adjustPeriod,Integer dayType,int receivePeriod){ |
|
|
|
|