From 694c4f95193c256132b49d3e91248e9fbfd9e913 Mon Sep 17 00:00:00 2001 From: winter <664946893@qq.com> Date: Fri, 13 Dec 2024 21:45:43 +0800 Subject: [PATCH] fix --- .../contract/WxRentContractController.java | 4 +- .../service/WxRentContractService.java | 4 +- .../impl/WxRentContractServiceImpl.java | 52 ++++++++++++++----- 3 files changed, 42 insertions(+), 18 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java index f9ef8fc94..32acf063f 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java @@ -796,7 +796,7 @@ public class WxRentContractController extends WxContractBaseController { if (null == wxRentContract.getSalesStartTime() || null == wxRentContract.getSalesEndTime()) { return new ResultData(Result.ERROR, "时间不能为空"); } - return new ResultData(wxRentContractService.setRevenueSales(rentContract,wxRentContract.getSalesMoney(),wxRentContract.getSalesStartTime(),wxRentContract.getSalesEndTime(),wxRentContract.getPropertyContractId())); + return new ResultData(wxRentContractService.setRevenueSales(this.getUser(),rentContract,wxRentContract.getSalesMoney(),wxRentContract.getSalesStartTime(),wxRentContract.getSalesEndTime(),wxRentContract.getPropertyContractId())); } //查询合同年限 @@ -850,7 +850,7 @@ public class WxRentContractController extends WxContractBaseController { return new ResultData(Result.ERROR, "合同未设置跳点,不用做汇算"); } rentContract.setPropertyContractId(wxRentContract.getPropertyContractId()); - return new ResultData(wxRentContractService.calcuteYearsRevenueRentUp(rentContract)); + return new ResultData(wxRentContractService.calcuteYearsRevenueRentUp(this.getUser(),rentContract)); } //查询合同年度汇算账单列表 diff --git a/mallinkService/src/main/java/com/iformall/service/WxRentContractService.java b/mallinkService/src/main/java/com/iformall/service/WxRentContractService.java index 84f1c935b..0aafddf1a 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxRentContractService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxRentContractService.java @@ -150,11 +150,11 @@ public interface WxRentContractService { List getContractSales(WxRentContract wxRentContract); - WxRentContractRevenueSetSalesVo setRevenueSales(WxRentContract rentcontract,String sales,Date startime, Date endtime,Long propertyContractId); + WxRentContractRevenueSetSalesVo setRevenueSales(MallUserInfo user,WxRentContract rentcontract,String sales,Date startime, Date endtime,Long propertyContractId); void setContractSalesConfirm(WxRentContract wxRentContract); - WxRentContractYearsSumVo calcuteYearsRevenueRentUp(WxRentContract rentcontract); + WxRentContractYearsSumVo calcuteYearsRevenueRentUp(MallUserInfo user,WxRentContract rentcontract); List findJumpList(WxRentContractRevenueJump jump); 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 b8d9b32cb..a32b62d18 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -2768,7 +2768,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) @Override - public WxRentContractRevenueSetSalesVo setRevenueSales(WxRentContract rentcontract, String sales, Date startime, Date endtime, Long propertyContractId) { + public WxRentContractRevenueSetSalesVo setRevenueSales(MallUserInfo user,WxRentContract rentcontract, String sales, Date startime, Date endtime, Long propertyContractId) { //如果账单存在缴费,付款,减免,冲抵,等情况,则不允许。 WxAllBill bq = wxBillAllHelper.generateRentContractQueryBill(rentcontract, rentcontract.getId(),startime,endtime); List rentBillList = wxAllBillMapper.findList(bq); @@ -2945,10 +2945,10 @@ public class WxRentContractServiceImpl implements WxRentContractService { sale.setUpdateTime(new Date()); wxRentContractRevenueSalesMapper.insert(sale); } - return handleBills(sb,rentcontract,propertyContractId,needpay,rentBillList,startime,endtime,EnumBillExtraCreateFrom.RNET_REVENUE_SALES,propertyBillList,rentPriceArrs,bussinessManagerPriceArrs,operationManagerPriceArrs,propertyContractArrs,yearIndex); + return handleBills(user,sb,rentcontract,propertyContractId,needpay,rentBillList,startime,endtime,EnumBillExtraCreateFrom.RNET_REVENUE_SALES,propertyBillList,rentPriceArrs,bussinessManagerPriceArrs,operationManagerPriceArrs,propertyContractArrs,yearIndex); } - private WxRentContractRevenueSetSalesVo handleBills(StringBuffer sb,WxRentContract rentcontract,Long propertyContractId, String needpay,List rentBillList,Date startDate,Date endDate, + private WxRentContractRevenueSetSalesVo handleBills(MallUserInfo user,StringBuffer sb,WxRentContract rentcontract,Long propertyContractId, String needpay,List rentBillList,Date startDate,Date endDate, EnumBillExtraCreateFrom createFrom,List propertyBillList,String[] rentPriceArrs,String[] bussinessManagerPriceArrs,String[] operationManagerPriceArrs,String[] propertyContractArrs,int yearIndex) { //计算资金分摊的比例 租金,商业管理费,营业管理费,物业费。每个科目税点不一样,这样分摊能降低成本 @@ -3000,13 +3000,13 @@ public class WxRentContractServiceImpl implements WxRentContractService { suq.setStatus(EnumShopUsersStatus.LIVE.getCode()); Map shopUserMap = wxShopService.getShopUserMap(suq); - List rentBill = generateRentBill(shopIdList,shopUserMap,shopAreaRateMap,rentcontract,rentBillList,rentneedpay,rentRate,startDate,endDate,createFrom); + List rentBill = generateRentBill(user,shopIdList,shopUserMap,shopAreaRateMap,rentcontract,rentBillList,rentneedpay,rentRate,startDate,endDate,createFrom); - List propeBill = generatePropertyBill(shopIdList,shopUserMap,shopAreaRateMap,rentcontract, propertyContractId,propertyBillList,startDate,endDate, needpay, propertyRate,createFrom); + List propeBill = generatePropertyBill(user,shopIdList,shopUserMap,shopAreaRateMap,rentcontract, propertyContractId,propertyBillList,startDate,endDate, needpay, propertyRate,createFrom); - List bmbill = generateManageBill(shopIdList,shopUserMap,shopAreaRateMap,rentcontract, startDate,endDate, needpay, bussinessRate, EnumBillAllType.RENT_BUSSINESS_MANAGE,createFrom); + List bmbill = generateManageBill(user,shopIdList,shopUserMap,shopAreaRateMap,rentcontract, startDate,endDate, needpay, bussinessRate, EnumBillAllType.RENT_BUSSINESS_MANAGE,createFrom); - List ombill = generateManageBill(shopIdList,shopUserMap,shopAreaRateMap,rentcontract, startDate,endDate, needpay, operaterRate, EnumBillAllType.RENT_OPERATION_MANAGE,createFrom); + List ombill = generateManageBill(user,shopIdList,shopUserMap,shopAreaRateMap,rentcontract, startDate,endDate, needpay, operaterRate, EnumBillAllType.RENT_OPERATION_MANAGE,createFrom); WxRentContractRevenueSetSalesVo vo = new WxRentContractRevenueSetSalesVo(); vo.setTotal(needpay); @@ -3026,7 +3026,7 @@ 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, + public List generateManageBill(MallUserInfo user,List shopIds,Map shopUserMap,Map shopAreaRateMap,WxRentContract rentcontract, Date starttime, Date endtime,String total,String rate,EnumBillAllType type,EnumBillExtraCreateFrom createFrom) { WxAllBill bussinessmanageBill = new WxAllBill(); bussinessmanageBill.updateTenantInfo(rentcontract); @@ -3047,6 +3047,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { b.setReceivePay("0"); b.setBillRemark("账单金额重新计算生成新账单,原账单金额变为0"); b.setUpdatetime(new Date()); + b.setUpdateBy(user.getId()); + b.setUpdateByName(user.getName()); wxAllBillMapper.updateById(b); } } @@ -3077,13 +3079,19 @@ public class WxRentContractServiceImpl implements WxRentContractService { } b.setCusName(cusName); b.setCreatetime(new Date()); + b.setCreateBy(user.getId()); + b.setCreateByName(user.getName()); b.setUpdatetime(new Date()); + b.setUpdateBy(user.getId()); + b.setUpdateByName(user.getName()); b.setPriceDetail(""); b.setNeedPay(newmoney); b.setReceivePay(newmoney); b.setPay("0"); b.setStarttime(starttime); b.setEndtime(endtime); + b.setReceiveDate(starttime); + b.setPeriod(WxRentContractHelper.getPeriod(starttime)); b.setBillRemark(createFrom.getMessage()+"自动计算创建,科目总计分摊比率为:"+rate+",总应收金额为:"+bussinessmoney+"元,"+",本铺分担比例"+shoprate.toEngineeringString()); b.setExtraCreateFrom(createFrom.getCode()); b.setMoneyChangeDetail("自动计算创建,科目总计分摊比率为:"+rate+",总应收金额为:"+bussinessmoney+"元,"+",本铺分担比例"+shoprate.toEngineeringString()); @@ -3097,7 +3105,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { } @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) - public List generatePropertyBill(List shopIds,Map shopUserMap,Map shopAreaRateMap,WxRentContract rentcontract, + public List generatePropertyBill(MallUserInfo user,List shopIds,Map shopUserMap,Map shopAreaRateMap,WxRentContract rentcontract, Long propertyContractId,List propertyBillList,Date starttime,Date endtime,String total,String rate,EnumBillExtraCreateFrom createFrom) { String bussinessmoney = new BigDecimal(total).multiply(new BigDecimal(rate)).setScale(rentcontract.getDecimalSize(),BigDecimal.ROUND_HALF_UP).toPlainString(); if (null != propertyBillList ) { @@ -3108,6 +3116,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { _rb.setReceivePay("0"); _rb.setBillRemark("账单金额重新计算生成新账单,原账单金额变为0"); _rb.setUpdatetime(new Date()); + _rb.setUpdateBy(user.getId()); + _rb.setUpdateByName(user.getName()); wxAllBillMapper.updateById(_rb); } } @@ -3139,13 +3149,19 @@ public class WxRentContractServiceImpl implements WxRentContractService { } bmbill.setCusName(cusName); bmbill.setCreatetime(new Date()); + bmbill.setCreateBy(user.getId()); + bmbill.setCreateByName(user.getName()); bmbill.setUpdatetime(new Date()); + bmbill.setUpdateBy(user.getId()); + bmbill.setUpdateByName(user.getName()); bmbill.setPriceDetail(""); bmbill.setNeedPay(bussinessmoney); bmbill.setReceivePay(bussinessmoney); bmbill.setPay("0"); bmbill.setStarttime(starttime); bmbill.setEndtime(endtime); + bmbill.setReceiveDate(starttime); + bmbill.setPeriod(WxRentContractHelper.getPeriod(starttime)); bmbill.setBillRemark(createFrom.getMessage()+".自动计算创建,科目分摊比率为:"+rate+",总应收金额为:"+bussinessmoney+"元,"+",本铺分担比例"+shoprate.toEngineeringString()); bmbill.setExtraCreateFrom(createFrom.getCode()); bmbill.setMoneyChangeDetail("自动计算创建,科目分摊比率为:"+rate+",总应收金额为:"+bussinessmoney+"元,"+",本铺分担比例"+shoprate.toEngineeringString()); @@ -3159,7 +3175,7 @@ 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, + public List generateRentBill(MallUserInfo user,List shopIds,Map shopUserMap,Map shopAreaRateMap,WxRentContract rentcontract, List rentBillList,String money,String rate,Date starttime,Date endtime,EnumBillExtraCreateFrom createFrom) { //rentBillList , 如果是多个房间,则就有几个租金账单 if (null != rentBillList && rentBillList.size() > 0 ) { @@ -3170,6 +3186,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { b.setReceivePay("0"); b.setBillRemark("账单金额重新计算生成新账单,原账单金额变为0"); b.setUpdatetime(new Date()); + b.setUpdateBy(user.getId()); + b.setUpdateByName(user.getName()); wxAllBillMapper.updateById(b); } } @@ -3198,13 +3216,19 @@ public class WxRentContractServiceImpl implements WxRentContractService { } bmbill.setCusName(cusName); bmbill.setCreatetime(new Date()); + bmbill.setCreateBy(user.getId()); + bmbill.setCreateByName(user.getName()); bmbill.setUpdatetime(new Date()); + bmbill.setUpdateBy(user.getId()); + bmbill.setUpdateByName(user.getName()); bmbill.setPriceDetail(""); bmbill.setNeedPay(new BigDecimal(money).multiply(shoprate).toPlainString()); bmbill.setReceivePay(bmbill.getNeedPay()); bmbill.setPay("0"); bmbill.setStarttime(starttime); bmbill.setEndtime(endtime); + bmbill.setReceiveDate(starttime); + bmbill.setPeriod(WxRentContractHelper.getPeriod(starttime)); bmbill.setBillRemark(createFrom.getMessage()+".自动计算创建,科目分摊比例为"+rate+",计算总应收金额为:"+money+"元,"+",本铺分担比例"+shoprate.toEngineeringString()); bmbill.setExtraCreateFrom(createFrom.getCode()); bmbill.setMoneyChangeDetail("自动计算创建,科目分摊比例为"+rate+",计算总应收金额为:"+money+"元,"+",本铺分担比例"+shoprate.toEngineeringString()); @@ -3226,7 +3250,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) @Override - public WxRentContractYearsSumVo calcuteYearsRevenueRentUp(WxRentContract rentcontract) { + public WxRentContractYearsSumVo calcuteYearsRevenueRentUp(MallUserInfo user,WxRentContract rentcontract) { //查询销售总数 WxRentContractRevenueSales rsq = new WxRentContractRevenueSales(); rsq.updateTenantInfo(rentcontract); @@ -3319,14 +3343,14 @@ public class WxRentContractServiceImpl implements WxRentContractService { vo.setBillReceivePay(receivepay.toPlainString()); if ( new BigDecimal(vo.getOwe()).compareTo(new BigDecimal(0)) > 0) { - WxRentContractRevenueSetSalesVo svo = handelHuiSuanBills(rentcontract,vo.getOwe()); + WxRentContractRevenueSetSalesVo svo = handelHuiSuanBills(user,rentcontract,vo.getOwe()); vo.setBillList(svo.getBillList()); } return vo; } - private WxRentContractRevenueSetSalesVo handelHuiSuanBills(WxRentContract rentcontract,String owe) { + private WxRentContractRevenueSetSalesVo handelHuiSuanBills(MallUserInfo user,WxRentContract rentcontract,String owe) { //计算每一年的基数 List priceArrs = WxRentContractHelper.calcuteRentAndRevenuePrice(rentcontract); String[] rentPriceArrs = priceArrs.get(0); @@ -3351,7 +3375,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { yearIndex = 0; } StringBuffer sb = new StringBuffer(""); - return handleBills(sb,rentcontract,null,owe,null,rentcontract.getYearsBegin(),rentcontract.getYearsEnd(),EnumBillExtraCreateFrom.RNET_TIAODIAN_HUISUAN,null,rentPriceArrs,bussinessManagerPriceArrs,operationManagerPriceArrs,propertyContractArrs,yearIndex); + return handleBills(user,sb,rentcontract,null,owe,null,rentcontract.getYearsBegin(),rentcontract.getYearsEnd(),EnumBillExtraCreateFrom.RNET_TIAODIAN_HUISUAN,null,rentPriceArrs,bussinessManagerPriceArrs,operationManagerPriceArrs,propertyContractArrs,yearIndex); }