Просмотр исходного кода

[bug][修改][1001640]

release_toaliyun_real
luozukai 7 лет назад
Родитель
Сommit
3d2fe940f4
1 измененных файлов: 19 добавлений и 17 удалений
  1. +19
    -17
      mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java

+ 19
- 17
mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java Просмотреть файл

@@ -876,6 +876,10 @@ public class WxRentContractServiceImpl implements WxRentContractService {
}

List<BillTimeVo> billTimeVoList = initBillTimeList(wxRentContract.getRentalStartDate(),wxRentContract.getRentalEndDate(),wxRentContract.getAdjustPeriod(),dayType,receivePeriod);
for (BillTimeVo vo:billTimeVoList) {
System.out.println("ooooooooo");
System.out.println(sd.format(vo.getStartDate()) + " "+sd.format(vo.getEndDate()) );
}

int index = 0;
for (BillTimeVo billTimeVo : billTimeVoList){
@@ -936,10 +940,8 @@ public class WxRentContractServiceImpl implements WxRentContractService {
double needpayD = WxRentContractServiceImpl.getNeedPay(0,price,wxBillRent.getStarttime(),wxBillRent.getEndtime());
needpay = new Double(needpayD).longValue();
}else{
//当天也算,加1天
Date newEndDate = DateUtils.getDaySet(wxBillRent.getEndtime(),Calendar.DATE,1);
//按月
int[] diff = DateUtils.getDiff(wxBillRent.getStarttime(),newEndDate);
int[] diff = DateUtils.getDiff(wxBillRent.getStarttime(),wxBillRent.getEndtime());
needpay = diff[0]*price;

double oneDayProce = (double) price/DateUtils.getMonthDayCount(wxRentContract.getRentalEndDate());
@@ -1746,7 +1748,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
*/
public static double getNeedPay(long monthPrice,long dayPrice,Date start,Date end){
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat sdM = new SimpleDateFormat("MM");
SimpleDateFormat sdM = new SimpleDateFormat("yyyy-MM");
Double total;
int[] diff;

@@ -1757,20 +1759,20 @@ public class WxRentContractServiceImpl implements WxRentContractService {
}else{
price = dayPrice;
}
Date currEnd = DateUtils.getLastDayForMonth(start);

System.out.println("-----------");
System.out.println(sd.format(start));
System.out.println(sd.format(currEnd));

//同一天
if(sd.format(start).equals(sd.format(end))){
total = 1 * price; //算1天
return total;
}else{
diff = DateUtils.getDiff(start,currEnd);
total = (diff[1]+1) * price;
return 1 * price; //算1天
}
System.out.println("-------total:"+total);
//同月
if(sdM.format(start).equals(sdM.format(end))){
diff = DateUtils.getDiff(start,end);
return (diff[1]+1) * price;
}

Date currEnd = DateUtils.getLastDayForMonth(start);
diff = DateUtils.getDiff(start,currEnd);
total = (diff[1]+1) * price;

while (true){
Date monthStartDate = DateUtils.getDaySet(currEnd,Calendar.DATE,1);
@@ -1782,6 +1784,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
}

System.out.println("-------monthStartDate:"+sd.format(monthStartDate));
System.out.println("-------monthStartDate:"+sd.format(end));

//最后一个月
if(sdM.format(monthStartDate).equals(sdM.format(end))){
@@ -1797,7 +1800,6 @@ public class WxRentContractServiceImpl implements WxRentContractService {
diff = DateUtils.getDiff(monthStartDate,currEnd);
total += price * (diff[1] +1);
}
System.out.println("-------total:"+total);
}
return total;
}
@@ -1805,7 +1807,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
public static void main(String[] args) throws Exception{
long tprice = 100;
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd");
Date start = sd.parse("2019-05-28");
Date start = sd.parse("2019-05-13");
Date end = sd.parse("2019-07-05");

System.out.println("===="+new WxRentContractServiceImpl().getNeedPay(tprice,0,start,end));;


Загрузка…
Отмена
Сохранить