|
|
@@ -760,13 +760,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { |
|
|
long[] priceArr = new long[arraySize]; |
|
|
long[] priceArr = new long[arraySize]; |
|
|
for (int i = 0; i < arraySize; i++) { |
|
|
for (int i = 0; i < arraySize; i++) { |
|
|
JSONObject rentInfoObject = rentInfoArray.getJSONObject(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); |
|
|
priceList.add(priceArr); |
|
|
//大于一年 |
|
|
//大于一年 |
|
|
@@ -946,16 +940,23 @@ public class WxRentContractServiceImpl implements WxRentContractService { |
|
|
|
|
|
|
|
|
//按日 |
|
|
//按日 |
|
|
if (wxRentContract.getPriceUnit().equals(EnumPriceUnit.D.getCode())){ |
|
|
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(); |
|
|
needpay = new Double(needpayD).longValue(); |
|
|
}else{ |
|
|
}else{ |
|
|
|
|
|
//年 需要除12 |
|
|
|
|
|
Double priceD = new Double(price); |
|
|
|
|
|
if(EnumPriceUnit.Y.getCode().equals(wxRentContract.getPriceUnit())){ |
|
|
|
|
|
priceD = new Double(price)/12; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
//当天也算,加1天 |
|
|
//当天也算,加1天 |
|
|
Date newEndDate = DateUtils.getDaySet(wxBillRent.getEndtime(),Calendar.DATE,1); |
|
|
Date newEndDate = DateUtils.getDaySet(wxBillRent.getEndtime(),Calendar.DATE,1); |
|
|
//按月 |
|
|
//按月 |
|
|
int[] diff = DateUtils.getDiff(wxBillRent.getStarttime(),newEndDate); |
|
|
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; |
|
|
needpay += diff[1] * oneDayProce; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@@ -1778,7 +1779,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { |
|
|
* @param end |
|
|
* @param end |
|
|
* @return |
|
|
* @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 sd = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
SimpleDateFormat sdM = new SimpleDateFormat("yyyy-MM"); |
|
|
SimpleDateFormat sdM = new SimpleDateFormat("yyyy-MM"); |
|
|
Double total; |
|
|
Double total; |
|
|
@@ -1842,7 +1843,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { |
|
|
Date start = sd.parse("2020-05-29"); |
|
|
Date start = sd.parse("2020-05-29"); |
|
|
Date end = sd.parse("2020-07-28"); |
|
|
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){ |
|
|
public static List<BillTimeVo> initBillTimeList(Date start,Date end,Integer adjustPeriod,Integer dayType,int receivePeriod){ |
|
|
|