|
|
|
@@ -2600,14 +2600,47 @@ public class WxRentContractServiceImpl implements WxRentContractService { |
|
|
|
|
|
|
|
|
|
|
|
private BigDecimal[] calcuteReveneuJump(BigDecimal sales,WxRentContract rentcontract,Date startDate,Date endDate,List<Date> freePeriods) {
|
|
|
|
BigDecimal revenueDecimal = new BigDecimal(0);
|
|
|
|
BigDecimal rentDecimal = new BigDecimal(0);
|
|
|
|
//根据免租期来计算
|
|
|
|
List<Date> validDates = WxRentContractHelper.getValidDays(startDate, endDate, freePeriods);
|
|
|
|
if (null == validDates || validDates.size() <= 0 ) {
|
|
|
|
BigDecimal[] bs = new BigDecimal[] {revenueDecimal,rentDecimal};
|
|
|
|
return bs;
|
|
|
|
}
|
|
|
|
int allDays = DateUtils.daysBetween(startDate,endDate)+1;
|
|
|
|
boolean isFull = false;
|
|
|
|
if (allDays == validDates.size()) {
|
|
|
|
isFull = true;
|
|
|
|
}
|
|
|
|
WxRentContractRevenueJump jq = new WxRentContractRevenueJump();
|
|
|
|
jq.updateTenantInfo(rentcontract);
|
|
|
|
jq.setRentContractId(rentcontract.getId());
|
|
|
|
jq.setSortColumn(" minMoney asc");
|
|
|
|
BigDecimal revenueDecimal = new BigDecimal(0);
|
|
|
|
BigDecimal rentDecimal = new BigDecimal(0);
|
|
|
|
List<WxRentContractRevenueJump> jumpList = wxRentContractRevenueJumpMapper.findList(jq);
|
|
|
|
if (null != jumpList && jumpList.size() > 0 ) {
|
|
|
|
//不是满时间段的,要按天来计算
|
|
|
|
if (!isFull) {
|
|
|
|
Date realEndStart = DateUtils.getDaySet(endDate, Calendar.SECOND, 1);
|
|
|
|
int[] diffs = DateUtils.getDiff(startDate, realEndStart);
|
|
|
|
if (diffs[0] <= 0 ) {
|
|
|
|
if (rentcontract.getDayPriceCalcute().intValue() == EnumRentDayPriceCalcute.AVERAGE_DAYS.getCode()) {
|
|
|
|
sales = sales.multiply(new BigDecimal(validDates.size())).divide(new BigDecimal(30));
|
|
|
|
}else {
|
|
|
|
sales = sales.multiply(new BigDecimal(validDates.size())).divide(new BigDecimal(allDays));
|
|
|
|
}
|
|
|
|
}else {
|
|
|
|
Date preextraStartDay = DateUtils.getTimeAfterMonths(diffs[0], startDate);
|
|
|
|
Date extraStartDayMonthEnd = DateUtils.getLastDayForMonth(preextraStartDay);
|
|
|
|
int predays = DateUtils.daysBetween(preextraStartDay, extraStartDayMonthEnd)+1;
|
|
|
|
if (rentcontract.getDayPriceCalcute().intValue() == EnumRentDayPriceCalcute.AVERAGE_DAYS.getCode()) {
|
|
|
|
BigDecimal days = new BigDecimal(diffs[0]).multiply(new BigDecimal(30)).add(new BigDecimal(predays));
|
|
|
|
sales = sales.multiply(new BigDecimal(validDates.size())).divide(days);
|
|
|
|
}else {
|
|
|
|
sales = sales.multiply(new BigDecimal(validDates.size())).divide(new BigDecimal(allDays));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (int i = 0 ; i< jumpList.size() ; i ++) {
|
|
|
|
WxRentContractRevenueJump rj = jumpList.get(i);
|
|
|
|
String minMoney = rj.getMinMoney();
|
|
|
|
|