| @@ -2806,6 +2806,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| propertyBillq.setBillType(EnumBillAllType.PROPERTY.getCode()); | |||
| propertyBillq.setEnergyFeesId(EnumBillAllType.PROPERTY.getEnergyFeesId()); | |||
| propertyBillq.setIsPreview(EnumYesOrNo.NO.getCode()); | |||
| propertyBillq.setNoExtraCreateFrom(EnumYesOrNo.YES.getCode()); | |||
| propertyBillq.setStarttimeEqual(startime); | |||
| propertyBillq.setEndtimeEqual(endtime); | |||
| propertyBillList = wxAllBillMapper.findList(propertyBillq); | |||
| @@ -2991,13 +2992,6 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| String propertyRate = moneyShareRates[3]; | |||
| //更新账单费用 | |||
| String rentneedpay = new BigDecimal(needpay).multiply(new BigDecimal(rentRate)).setScale(rentcontract.getDecimalSize(),BigDecimal.ROUND_HALF_UP).toPlainString(); | |||
| if (null != rentBillList) { | |||
| for (int i = 0 ; i < rentBillList.size(); i++){ | |||
| WxAllBill _rb = rentBillList.get(i); | |||
| wxAllBillMapper.deleteById(_rb.getId(), _rb.getTenantId()); | |||
| } | |||
| } | |||
| List<Long> shopIdList = rentcontract.shopIdsByRentInfo(); | |||
| Map<Long, BigDecimal> shopAreaRateMap = rentcontract.getRentShopArea(); | |||
| WxShopUsers suq = new WxShopUsers(); | |||
| @@ -3006,7 +3000,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| suq.setStatus(EnumShopUsersStatus.LIVE.getCode()); | |||
| Map<Long,WxShopUsers> shopUserMap = wxShopService.getShopUserMap(suq); | |||
| List<WxAllBill> rentBill = generateRentBill(shopIdList,shopUserMap,shopAreaRateMap,rentcontract,rentneedpay,rentRate,startDate,endDate,createFrom); | |||
| List<WxAllBill> rentBill = generateRentBill(shopIdList,shopUserMap,shopAreaRateMap,rentcontract,rentBillList,rentneedpay,rentRate,startDate,endDate,createFrom); | |||
| List<WxAllBill> propeBill = generatePropertyBill(shopIdList,shopUserMap,shopAreaRateMap,rentcontract, propertyContractId,propertyBillList,startDate,endDate, needpay, propertyRate,createFrom); | |||
| @@ -3034,13 +3028,13 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public List<WxAllBill> generateManageBill(List<Long> shopIds,Map<Long,WxShopUsers> shopUserMap,Map<Long, BigDecimal> shopAreaRateMap,WxRentContract rentcontract, | |||
| Date starttime, Date endtime,String total,String rate,EnumBillAllType type,EnumBillExtraCreateFrom createFrom) { | |||
| //商业管理费,营运管理费应收改为0,因为金额已经合并了 | |||
| WxAllBill bussinessmanageBill = new WxAllBill(); | |||
| bussinessmanageBill.updateTenantInfo(rentcontract); | |||
| bussinessmanageBill.setBillType(type.getCode()); | |||
| bussinessmanageBill.setEnergyFeesId(type.getEnergyFeesId()); | |||
| bussinessmanageBill.setRentContractId(rentcontract.getId()); | |||
| bussinessmanageBill.setIsPreview(EnumYesOrNo.NO.getCode()); | |||
| bussinessmanageBill.setNoExtraCreateFrom(EnumYesOrNo.YES.getCode()); | |||
| bussinessmanageBill.setStarttimeEqual(starttime); | |||
| bussinessmanageBill.setEndtimeEqual(endtime); | |||
| List<WxAllBill> bmbillList = wxAllBillMapper.findList(bussinessmanageBill); | |||
| @@ -3049,7 +3043,11 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| //查询每一个铺位的 | |||
| for (int i = 0 ; i < bmbillList.size() ; i ++) { | |||
| WxAllBill b = bmbillList.get(i); | |||
| wxAllBillMapper.deleteById(b.getId(),b.getTenantId()); | |||
| //把原有的账单应收金额变为0 | |||
| b.setReceivePay("0"); | |||
| b.setBillRemark("账单金额重新计算生成新账单,原账单金额变为0"); | |||
| b.setUpdatetime(new Date()); | |||
| wxAllBillMapper.updateById(b); | |||
| } | |||
| } | |||
| if (new BigDecimal(bussinessmoney).compareTo(new BigDecimal(0)) > 0 ) { | |||
| @@ -3106,7 +3104,11 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| if (null != propertyBillList) { | |||
| for (int i = 0 ; i < propertyBillList.size(); i++){ | |||
| WxAllBill _rb = propertyBillList.get(i); | |||
| wxAllBillMapper.deleteById(_rb.getId(), _rb.getTenantId()); | |||
| //把原有的账单应收金额变为0 | |||
| _rb.setReceivePay("0"); | |||
| _rb.setBillRemark("账单金额重新计算生成新账单,原账单金额变为0"); | |||
| _rb.setUpdatetime(new Date()); | |||
| wxAllBillMapper.updateById(_rb); | |||
| } | |||
| } | |||
| } | |||
| @@ -3158,7 +3160,20 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public List<WxAllBill> generateRentBill(List<Long> shopIds,Map<Long,WxShopUsers> shopUserMap,Map<Long, BigDecimal> shopAreaRateMap,WxRentContract rentcontract, | |||
| String money,String rate,Date starttime,Date endtime,EnumBillExtraCreateFrom createFrom) { | |||
| List<WxAllBill> rentBillList,String money,String rate,Date starttime,Date endtime,EnumBillExtraCreateFrom createFrom) { | |||
| //rentBillList , 如果是多个房间,则就有几个租金账单 | |||
| if (null != rentBillList && rentBillList.size() > 0 ) { | |||
| //查询每一个铺位的 | |||
| for (int i = 0 ; i < rentBillList.size() ; i ++) { | |||
| WxAllBill b = rentBillList.get(i); | |||
| //把原有的账单应收金额变为0 | |||
| b.setReceivePay("0"); | |||
| b.setBillRemark("账单金额重新计算生成新账单,原账单金额变为0"); | |||
| b.setUpdatetime(new Date()); | |||
| wxAllBillMapper.updateById(b); | |||
| } | |||
| } | |||
| List<WxAllBill> billList = new ArrayList<WxAllBill>(); | |||
| for (int i = 0 ; i < shopIds.size(); i++) { | |||
| Long sid = shopIds.get(i); | |||