@@ -1011,27 +1011,11 @@ public class WxRentContractServiceImpl implements WxRentContractService {
}else {
sb.append("跳点规则计算金额:"+jumppay.toPlainString()+",扣点规则计算金额:"+needpay+".");
}
//如果是取高的,则取高计算
if (rentcontract.getType().intValue() == EnumAgileContractType.RENEVUE_UP.getCode().intValue()) {
//查询所有参与取高的款项的账单
WxRentContractAgileUnDeposit udq = new WxRentContractAgileUnDeposit();
udq.updateTenantInfo(rentcontract);
udq.setRentContractId(rentcontract.getId());
udq.setJoinRenevueUp(EnumYesOrNo.YES.getCode());
List<Long> udlist = wxAgileContractService.findUnDepositFeesIdList(udq);
if (null != udlist && udlist.size() > 0 ){
WxAllBill udbill = new WxAllBill();
udbill.updateTenantInfo(rentcontract);
udbill.setRentContractId(rentcontract.getId());
udbill.setEnergyFeesIds(udlist);
BigDecimal uneedPay = wxAllBillMapper.getReceivePaySum(udbill);
if (null != uneedPay && uneedPay.compareTo(new BigDecimal(0)) > 0 ){
sb.append("参与取高款项计算金额:"+uneedPay.toPlainString());
if (uneedPay.compareTo(new BigDecimal(needpay)) > 0 ) {
needpay = uneedPay.toPlainString();
}
}
BigDecimal uneedPay = getJoinRenevueUpFeesReceivePayTotal(rentcontract,startime,endtime,true);
if (null != uneedPay && uneedPay.compareTo(new BigDecimal(0)) > 0 ){
sb.append("参与取高款项计算金额:"+uneedPay.toPlainString());
if (uneedPay.compareTo(new BigDecimal(needpay)) > 0 ) {
needpay = uneedPay.toPlainString();
}
}
@@ -1043,6 +1027,35 @@ public class WxRentContractServiceImpl implements WxRentContractService {
}
}
private BigDecimal getJoinRenevueUpFeesReceivePayTotal(WxRentContract rentcontract,Date begin,Date end,boolean isEqualTime) {
//如果是取高的,则取高计算
if (rentcontract.getType().intValue() == EnumAgileContractType.RENEVUE_UP.getCode().intValue()) {
//查询所有参与取高的款项的账单
WxRentContractAgileUnDeposit udq = new WxRentContractAgileUnDeposit();
udq.updateTenantInfo(rentcontract);
udq.setRentContractId(rentcontract.getId());
udq.setJoinRenevueUp(EnumYesOrNo.YES.getCode());
List<Long> udlist = wxAgileContractService.findUnDepositFeesIdList(udq);
if (null != udlist && udlist.size() > 0 ){
WxAllBill udbill = new WxAllBill();
udbill.updateTenantInfo(rentcontract);
udbill.setRentContractId(rentcontract.getId());
udbill.setIsPreview(EnumYesOrNo.NO.getCode());
udbill.setEnergyFeesIds(udlist);
if (isEqualTime) {
udbill.setStarttimeEqual(begin);
udbill.setEndtimeEqual(end);
}else {
udbill.setStarttime(rentcontract.getYearsBegin());
udbill.setEndtime(rentcontract.getYearsEnd());
};
BigDecimal uneedPay = wxAllBillMapper.getReceivePaySum(udbill);
return uneedPay;
}
}
return null;
}
private void addRevenueSales(WxRentContract rentcontract,Date starttime,Date endtime,String needpay,String sales,BigDecimal saleDecimalValid) {
WxRentContractRevenueSales rs = new WxRentContractRevenueSales();
rs.updateTenantInfo(rentcontract);
@@ -1242,27 +1255,12 @@ public class WxRentContractServiceImpl implements WxRentContractService {
}
}
BigDecimal receivepay = new BigDecimal(0);
//查询合同租金所有应收的账单
//查询所有租金+营业管理费+商业管理费账单的信息,因为设置销售额会自动的创建或者更新对应的账单
WxAllBill rentBillq = new WxAllBill();
rentBillq.updateTenantInfo(rentcontract);
rentBillq.setRentContractId(rentcontract.getId());
List<Long> feesIdList = new ArrayList<Long>();
//feesIdList.add(EnumBillAllType.RENT.getEnergyFeesId());
//feesIdList.add(EnumBillAllType.RENT_BUSSINESS_MANAGE.getEnergyFeesId());
//feesIdList.add(EnumBillAllType.RENT_OPERATION_MANAGE.getEnergyFeesId());
rentBillq.setEnergyFeesIds(feesIdList);
rentBillq.setIsPreview(EnumYesOrNo.NO.getCode());
rentBillq.setStarttime(rentcontract.getYearsBegin());
rentBillq.setEndtime(rentcontract.getYearsEnd());
WxBillSum rentBillSum = wxAllBillMapper.getBillMonthSum(rentBillq);
if (null != rentBillSum) {
receivepay = receivepay.add(rentBillSum.getNeedPayNumber());
//查询所有参与取高的账单金额
BigDecimal receivepay = getJoinRenevueUpFeesReceivePayTotal(rentcontract,rentcontract.getYearsBegin(),rentcontract.getYearsEnd(),false);
if (null == receivepay ){
receivepay = new BigDecimal(0);
}
//查询对应的物业账单,包括录入销售额自动生成的
WxRentContractYearsSumVo vo = new WxRentContractYearsSumVo();
vo.setTotalSales(sum.toPlainString());
vo.setTotalRevenue(jumpRevenuePay.toPlainString());
@@ -1277,32 +1275,8 @@ public class WxRentContractServiceImpl implements WxRentContractService {
}
private WxRentContractRevenueSetSalesVo handelHuiSuanBills(MallUserInfo user,WxRentContract rentcontract,String owe) {
// //计算每一年的基数
// List<String[]> priceArrs = WxRentContractHelper.calcuteRentAndRevenuePrice(rentcontract);
// String[] rentPriceArrs = priceArrs.get(0);
// //String[] revenuePriceArrs = priceArrs.get(1);
// //计算商业管理费
// String[] bussinessManagerPriceArrs = WxRentContractHelper.calcuteBussinessManagementFee(rentcontract);
// //计算运营管理费
// String[] operationManagerPriceArrs = WxRentContractHelper.calcuteOperatingManagementFee(rentcontract);
//
// //物业费单价
// String[] propertyContractArrs = null;
// List<Date> 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 (rentcontract.getYearsBegin().before(yearEndDate) || rentcontract.getYearsEnd().equals(yearEndDate)) {
// yearIndex = i-1;
// break;
// }
// }
// if (yearIndex <= 0 ) {
// yearIndex = 0;
// }
// StringBuffer sb = new StringBuffer("");
// return handleBills(user,sb,rentcontract,null,owe,null,rentcontract.getYearsBegin(),rentcontract.getYearsEnd(),EnumBillExtraCreateFrom.RNET_TIAODIAN_HUISUAN,null,rentPriceArrs,bussinessManagerPriceArrs,operationManagerPriceArrs,propertyContractArrs,yearIndex);
return null;
StringBuffer sb = new StringBuffer("");
return handleBills(user,sb,rentcontract,owe,rentcontract.getYearsBegin(),rentcontract.getYearsEnd(),EnumBillExtraCreateFrom.RNET_TIAODIAN_HUISUAN);
}
@@ -1311,10 +1285,4 @@ public class WxRentContractServiceImpl implements WxRentContractService {
return wxRentContractRevenueJumpMapper.findList(jump);
}
@Override
public BigDecimal calcuteContractUsedShopArea(WxRentContract wxRentContract,Long shopId) {
//根据合同区间查询已使用合同的总面积
return null;
}
}