From ade9c38e4d1b6d0300fe8a86963f805d34f1ec32 Mon Sep 17 00:00:00 2001 From: winter Date: Sat, 17 Aug 2024 20:23:28 +0800 Subject: [PATCH] fix --- .../service/impl/WxRentContractServiceImpl.java | 11 +++++++---- .../src/main/java/com/iformall/utils/DateUtils.java | 2 ++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java index ee61848e3..57c2f2c7d 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -2635,9 +2635,11 @@ public class WxRentContractServiceImpl implements WxRentContractService { List yearList = this.getYearList(rentPriceArrs.length, 12, rentcontract.getRentalStartDate(),null); int yearIndex = 0; for( int i = 0 ; i < yearList.size() ; i ++) { - Date yearEndDate = yearList.get(i); - if (rentBill.getEndtime().before(yearEndDate) || rentBill.getEndtime().equals(yearEndDate)) { - yearIndex = i-1; + Date yearStartDate = yearList.get(i); + Date yearEndDate = DateUtils.getTimeAfterMonths(12, yearStartDate); + if (rentBill.getStarttime().equals(yearStartDate) || + (rentBill.getStarttime().after(yearStartDate) && (rentBill.getEndtime().before(yearEndDate) || rentBill.getEndtime().equals(yearEndDate)) )) { + yearIndex = i; break; } } @@ -2653,6 +2655,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { if (null != operationManagerPriceArrs) { rentTotal = rentTotal.add(new BigDecimal(operationManagerPriceArrs[yearIndex])); } + //此处需要物业合同合租金合同的计费周期一致,严谨的需要用到上面计算的propertyPrice if (null != propertyContractArrs) { rentTotal = rentTotal.add(new BigDecimal(propertyContractArrs[yearIndex])); } @@ -3084,7 +3087,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { yearIndex = 0; } StringBuffer sb = new StringBuffer(""); - return handleBills(sb,rentcontract,null,owe,null,rentcontract.getYearsEnd(),rentcontract.getYearsEnd(),EnumBillExtraCreateFrom.RNET_TIAODIAN_HUISUAN,null,rentPriceArrs,bussinessManagerPriceArrs,operationManagerPriceArrs,propertyContractArrs,yearIndex); + return handleBills(sb,rentcontract,null,owe,null,rentcontract.getYearsBegin(),rentcontract.getYearsEnd(),EnumBillExtraCreateFrom.RNET_TIAODIAN_HUISUAN,null,rentPriceArrs,bussinessManagerPriceArrs,operationManagerPriceArrs,propertyContractArrs,yearIndex); } diff --git a/mallinkService/src/main/java/com/iformall/utils/DateUtils.java b/mallinkService/src/main/java/com/iformall/utils/DateUtils.java index df4a1025d..d0ddc5f97 100755 --- a/mallinkService/src/main/java/com/iformall/utils/DateUtils.java +++ b/mallinkService/src/main/java/com/iformall/utils/DateUtils.java @@ -467,6 +467,7 @@ public class DateUtils { public static Date getTimeAfterDays(int days, Date myDate) { Calendar now = Calendar.getInstance(); now.setTime(myDate); + now.set(Calendar.MILLISECOND, 0); now.set(Calendar.DATE, now.get(Calendar.DATE) + days); return now.getTime(); } @@ -481,6 +482,7 @@ public class DateUtils { public static Date getTimeAfterMonths(int months, Date myDate) { Calendar now = Calendar.getInstance(); now.setTime(myDate); + now.set(Calendar.MILLISECOND, 0); now.set(Calendar.MONTH, now.get(Calendar.MONTH) + months); return now.getTime(); }