# Conflicts: # mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java # mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.javarelease_toaliyun_real
| @@ -564,7 +564,11 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| if(i == 0){//第一期 | |||
| if(wxPropertyContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode())){ | |||
| needpay = new Double(WxRentContractServiceImpl.getMonthNeedPay(priceD,billTimeVo.getStartDate(),billTimeVo.getEndDate())).longValue(); | |||
| if(isFirstDay(billTimeVo.getStartDate())){ | |||
| needpay = new Double(receivePeriod * priceD).longValue(); | |||
| }else{ | |||
| needpay = new Double(WxRentContractServiceImpl.getMonthNeedPay(priceD, billTimeVo.getStartDate(), billTimeVo.getEndDate())).longValue(); | |||
| } | |||
| }else{ | |||
| needpay = new Double(receivePeriod * priceD).longValue(); | |||
| } | |||
| @@ -620,6 +624,14 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| return resultMap; | |||
| } | |||
| public boolean isFirstDay(Date date){ | |||
| int dateInt = Integer.parseInt(new SimpleDateFormat("d").format(date)); | |||
| if(dateInt == 1){ | |||
| return true; | |||
| } | |||
| return false; | |||
| } | |||
| /** | |||
| * 根据商户/指定物业合同生成物业账单 | |||
| * @param wxMerchant | |||
| @@ -652,7 +664,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| //按月计租 | |||
| // if (propertyContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_MONTH.getCode()) | |||
| // ||propertyContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode())) { | |||
| result = buildRentMonth(wxMerchant, userId, propertyContract, receivePeriod, lease, rentalStartDate, price,isPreview); | |||
| result = buildRentMonth(wxMerchant, userId, propertyContract, receivePeriod, lease, rentalStartDate, price,isPreview); | |||
| // } else { | |||
| // //如果按日 | |||
| // List<Date> yearList = new ArrayList<>(); | |||
| @@ -918,3 +930,4 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| } | |||
| @@ -735,7 +735,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| //按月计租 | |||
| // if (wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_MONTH.getCode()) | |||
| // ||wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode())) { | |||
| rentList = buildRentMonth(wxMerchant, userId, wxRentContract, receivePeriod, lease, rentalStartDate, price,isPreview); | |||
| rentList = buildRentMonth(wxMerchant, userId, wxRentContract, receivePeriod, lease, rentalStartDate, price,isPreview); | |||
| // } else { | |||
| // //如果按日 | |||
| // List<Date> yearList = new ArrayList<>(); | |||
| @@ -952,7 +952,11 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| if(i == 0){//第一期 | |||
| if(wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode())){ | |||
| needpay = new Double(getMonthNeedPay(priceD,billTimeVo.getStartDate(),billTimeVo.getEndDate())).longValue(); | |||
| if(isFirstDay(billTimeVo.getStartDate())){ | |||
| needpay = new Double(receivePeriod * priceD).longValue(); | |||
| }else{ | |||
| needpay = new Double(getMonthNeedPay(priceD, billTimeVo.getStartDate(), billTimeVo.getEndDate())).longValue(); | |||
| } | |||
| }else{ | |||
| needpay = new Double(receivePeriod * priceD).longValue(); | |||
| } | |||
| @@ -1798,6 +1802,20 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| Double total = new Double(0); | |||
| int[] diff; | |||
| //同一天 | |||
| if(sd.format(start).equals(sd.format(end))){ | |||
| int dayCount = DateUtils.getMonthDayCount(start); | |||
| return 1 * (price/dayCount); | |||
| } | |||
| //同月 | |||
| if(sdM.format(start).equals(sdM.format(end))){ | |||
| diff = DateUtils.getDiff(start,end); | |||
| int dayCount = DateUtils.getMonthDayCount(start); | |||
| total += (diff[1]+1) * (price/dayCount); | |||
| return total; | |||
| } | |||
| //第一个月 | |||
| Date lastMonthDay = DateUtils.getLastDayForMonth(start); | |||
| diff = DateUtils.getDiff(start,lastMonthDay); | |||
| @@ -1955,3 +1973,4 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||