From 1390557840da7f5a10e59cef3579877b688e5646 Mon Sep 17 00:00:00 2001 From: winter <664946893@qq.com> Date: Fri, 13 Dec 2024 19:56:02 +0800 Subject: [PATCH] fix --- .../impl/WxRentContractServiceImpl.java | 39 +++++++++++++------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java index e44a2142e..b8d9b32cb 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -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 shopIdList = rentcontract.shopIdsByRentInfo(); Map shopAreaRateMap = rentcontract.getRentShopArea(); WxShopUsers suq = new WxShopUsers(); @@ -3006,7 +3000,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { suq.setStatus(EnumShopUsersStatus.LIVE.getCode()); Map shopUserMap = wxShopService.getShopUserMap(suq); - List rentBill = generateRentBill(shopIdList,shopUserMap,shopAreaRateMap,rentcontract,rentneedpay,rentRate,startDate,endDate,createFrom); + List rentBill = generateRentBill(shopIdList,shopUserMap,shopAreaRateMap,rentcontract,rentBillList,rentneedpay,rentRate,startDate,endDate,createFrom); List 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 generateManageBill(List shopIds,Map shopUserMap,Map 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 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 generateRentBill(List shopIds,Map shopUserMap,Map shopAreaRateMap,WxRentContract rentcontract, - String money,String rate,Date starttime,Date endtime,EnumBillExtraCreateFrom createFrom) { + List 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 billList = new ArrayList(); for (int i = 0 ; i < shopIds.size(); i++) { Long sid = shopIds.get(i);