|
|
|
@@ -2473,8 +2473,11 @@ public class WxRentContractServiceImpl implements WxRentContractService { |
|
|
|
}
|
|
|
|
//根据时间区间计算
|
|
|
|
//固定租金需要再计算,因为跳点设置的租金是单价
|
|
|
|
String rentNeedpay = WxRentContractHelper.getNeedPayMoney(freePeriods,rentcontract, rentDecimal.toPlainString(),startDate,
|
|
|
|
String rentNeedpay = "0";
|
|
|
|
if (rentDecimal.compareTo(new BigDecimal(0)) > 0 ) {
|
|
|
|
rentNeedpay = WxRentContractHelper.getNeedPayMoney(freePeriods,rentcontract, rentDecimal.toPlainString(),startDate,
|
|
|
|
endDate,0,0,false,rentcontract.getReceivePeriodUnit(),rentcontract.getReceivePeriod());
|
|
|
|
}
|
|
|
|
rentDecimal = new BigDecimal(rentNeedpay);
|
|
|
|
BigDecimal[] bs = new BigDecimal[] {revenueDecimal,rentDecimal};
|
|
|
|
return bs;
|
|
|
|
@@ -2531,10 +2534,13 @@ public class WxRentContractServiceImpl implements WxRentContractService { |
|
|
|
for( int i = 0 ; i < yearList.size() ; i ++) {
|
|
|
|
Date yearEndDate = yearList.get(i);
|
|
|
|
if (rentBill.getEndtime().before(yearEndDate) || rentBill.getEndtime().equals(yearEndDate)) {
|
|
|
|
yearIndex = i;
|
|
|
|
yearIndex = i-1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (yearIndex <= 0 ) {
|
|
|
|
yearIndex = 0;
|
|
|
|
}
|
|
|
|
//免租期
|
|
|
|
List<Date> freePeriods = getFreeDays(rentcontract);
|
|
|
|
//根据租金和扣点来计算
|
|
|
|
@@ -2551,11 +2557,15 @@ public class WxRentContractServiceImpl implements WxRentContractService { |
|
|
|
}else {
|
|
|
|
jumppay = jumppay.add(jumpRentPay);
|
|
|
|
}
|
|
|
|
|
|
|
|
StringBuffer sb = new StringBuffer();
|
|
|
|
if (jumppay.compareTo(new BigDecimal(needpay)) > 0 ) {
|
|
|
|
sb.append("跳点规则计算金额:"+jumppay.toPlainString()+",合同租金扣点规则计算金额:"+needpay+".");
|
|
|
|
needpay = jumppay.toPlainString();
|
|
|
|
}else {
|
|
|
|
sb.append("跳点规则计算金额:"+jumppay.toPlainString()+",合同租金扣点规则计算金额:"+needpay+".");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//保存销售额
|
|
|
|
WxRentContractRevenueSales rs = new WxRentContractRevenueSales();
|
|
|
|
rs.updateTenantInfo(rentcontract);
|
|
|
|
@@ -2583,7 +2593,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { |
|
|
|
}
|
|
|
|
|
|
|
|
//更新账单费用
|
|
|
|
rentBill.setMoneyChangeDetail("原合同租金金额:"+rentBill.getReceivePay()+"元,计算之后为:"+needpay+"元。");
|
|
|
|
sb.append("原合同租金金额:"+rentBill.getNeedPay()+"元,计算之后为:"+needpay+"元。");
|
|
|
|
rentBill.setMoneyChangeDetail(sb.toString());
|
|
|
|
rentBill.setReceivePay(needpay);
|
|
|
|
rentBill.setBillRemark("设置销售额,自动计算");
|
|
|
|
rentBill.setUpdatetime(new Date());
|
|
|
|
@@ -2595,7 +2606,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { |
|
|
|
wxAllBillMapper.updateById(rentBill);
|
|
|
|
//物业账单应收就改为0,因为金额已经合并了
|
|
|
|
if (null != propertyBill) {
|
|
|
|
propertyBill.setMoneyChangeDetail("原合同物业金额:"+propertyBill.getReceivePay()+"元,已合并到租金,调整为:0元。");
|
|
|
|
propertyBill.setMoneyChangeDetail("原合同物业金额:"+propertyBill.getNeedPay()+"元,已合并到租金,调整为:0元。");
|
|
|
|
propertyBill.setReceivePay("0");
|
|
|
|
propertyBill.setBillRemark("设置销售额,已自动计算合并到租金");
|
|
|
|
if (new BigDecimal(propertyBill.getOwe()).compareTo(new BigDecimal(0)) < 0 ) {
|
|
|
|
@@ -2628,12 +2639,13 @@ public class WxRentContractServiceImpl implements WxRentContractService { |
|
|
|
List<Long> billIdList = wxRentContractRevenueSalesMapper.findBillId(rsq);
|
|
|
|
Date realStartTime = null;
|
|
|
|
Date realEndTime = null;
|
|
|
|
if (null != billIdList || billIdList.size() > 0 ) {
|
|
|
|
|
|
|
|
if (null != billIdList && billIdList.size() > 0 ) {
|
|
|
|
WxAllBill abq = new WxAllBill();
|
|
|
|
abq.updateTenantInfo(rentcontract);
|
|
|
|
abq.setIds(billIdList);
|
|
|
|
abq.setStarttimeEqual(rentcontract.getYearsBegin());
|
|
|
|
abq.setStarttimeEqual(rentcontract.getYearsEnd());
|
|
|
|
abq.setStarttime(rentcontract.getYearsBegin());
|
|
|
|
abq.setEndtime(rentcontract.getYearsEnd());
|
|
|
|
abq.setSortColumn(" starttime asc");
|
|
|
|
List<WxAllBill> billList = wxAllBillMapper.findList(abq);
|
|
|
|
if (null == billList || billList.size() <= 0 ){
|
|
|
|
@@ -2642,7 +2654,14 @@ public class WxRentContractServiceImpl implements WxRentContractService { |
|
|
|
realStartTime = billList.get(0).getStarttime();
|
|
|
|
realEndTime = billList.get(billList.size()-1).getEndtime();
|
|
|
|
}
|
|
|
|
BigDecimal sum = new BigDecimal(0);
|
|
|
|
BigDecimal sum = wxRentContractRevenueSalesMapper.findSumSalesMoney(rsq);
|
|
|
|
if (null == sum || sum.compareTo(new BigDecimal(0)) <= 0 ) {
|
|
|
|
WxRentContractYearsSumVo vo = new WxRentContractYearsSumVo();
|
|
|
|
vo.setTotalSales("0");
|
|
|
|
vo.setTotalRevenue("0");
|
|
|
|
vo.setBillReceivePay("0");
|
|
|
|
return vo;
|
|
|
|
}
|
|
|
|
//计算跳点。
|
|
|
|
BigDecimal[] jumppays = calcuteReveneuJump(sum, rentcontract,rentcontract.getYearsBegin(), rentcontract.getYearsEnd(),null);
|
|
|
|
BigDecimal jumpRevenuePay = jumppays[0];
|
|
|
|
|