From 7102e3280a766774e6a9e8bc903c7024ea51c155 Mon Sep 17 00:00:00 2001 From: winter <664946893@qq.com> Date: Mon, 11 Nov 2024 19:58:59 +0800 Subject: [PATCH] fix --- .../iformall/domain/po/WxRentContract.java | 13 +---- .../impl/WxAgileContractServiceImpl.java | 47 +++++++++++++++---- .../impl/WxRentContractServiceImpl.java | 38 ++++++++++----- 3 files changed, 64 insertions(+), 34 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java index 8a1ccb581..78f238a71 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java @@ -474,7 +474,7 @@ public class WxRentContract extends TenantEntity { return sb.toString(); } - public Map getRentShopAreaRate() { + public Map getRentShopArea() { String rentInfo = this.getRentInfo(); if (!StringUtils.isBlank(rentInfo)) { Map shopAreaMap = new HashMap(); @@ -492,16 +492,7 @@ public class WxRentContract extends TenantEntity { total = total.add(new BigDecimal("rentArea")); } } - if (total.compareTo(new BigDecimal(0)) <= 0 ) { - total = new BigDecimal(1); - } - Map shopAreaRateMap = new HashMap(); - for (Iterator it = shopAreaMap.keySet().iterator();it.hasNext();) { - Long sid = it.next(); - BigDecimal sa = shopAreaMap.get(sid); - shopAreaRateMap.put(sid, sa.divide(total,Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP)); - } - return shopAreaRateMap; + return shopAreaMap; } return null; } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxAgileContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxAgileContractServiceImpl.java index e6d19fe82..b376ef451 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxAgileContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxAgileContractServiceImpl.java @@ -20,6 +20,7 @@ import com.iformall.domain.po.WxRentContractAgileDepositShop; import com.iformall.domain.po.WxRentContractAgileUnDeposit; import com.iformall.domain.po.WxRentContractAgileUnDepositItem; import com.iformall.domain.po.WxShop; +import com.iformall.domain.po.WxShopUsers; import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.vo.BillTimeVo; import com.iformall.enums.EnumBillAllType; @@ -392,7 +393,7 @@ public class WxAgileContractServiceImpl implements WxAgileContractService { Map typeMap = wxEnergyService.getFeesMap(fq); //根据关联的店铺面积来分金额 - Map shopAreaRateMap = wxRentContract.getRentShopAreaRate(); + Map shopAreaRateMap = wxRentContract.getRentShopArea(); if (null == shopAreaRateMap) { throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"无店铺信息"); } @@ -406,7 +407,9 @@ public class WxAgileContractServiceImpl implements WxAgileContractService { WxEnergyFees fees = typeMap.get(deposit.getFeesId()); for (int j = 0 ; j < shopIdList.size(); j++ ) { Long sid = shopIdList.get(j); - BigDecimal shoprate = shopAreaRateMap.get(sid); + BigDecimal shoprentArea = shopAreaRateMap.get(sid); + BigDecimal shoprate = shoprentArea.divide(new BigDecimal(wxRentContract.getRentArea()),wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP); + WxAllBill wxBillDeposit = new WxAllBill(); wxBillDeposit.setId(idWorker.nextId()); wxBillDeposit.updateTenantInfo(wxRentContract); @@ -468,7 +471,6 @@ public class WxAgileContractServiceImpl implements WxAgileContractService { EnumRentDayPriceCalcute dayPriceCalcute = EnumRentDayPriceCalcute.getEnum(contract.getDayPriceCalcute()); List yearsBeginList = WxRentContractAgileHelper.getYearsBeginList(contract.getRentalStartDate(), contract.getRentalEndDate()); - List List insertList = new ArrayList(); final IdWorker idWorker = IdWorker.get(); @@ -508,12 +510,37 @@ public class WxAgileContractServiceImpl implements WxAgileContractService { } } - private WxAllBill generateUnDepositBill(final IdWorker idWorker,WxRentContractAgileUnDeposit unDeposit,WxEnergyFees fees, - Date start,Date end,Date receiveDate,String needpay,WxRentContractAgileUnDepositItem item,MallUserInfo user) { + private List generateUnDepositBill(List shopIdList,Map shopAreaRateMap,Map shopUserMap,final IdWorker idWorker,WxRentContractAgileUnDeposit unDeposit, + WxEnergyFees fees,Date start,Date end,Date receiveDate,String needpay,WxRentContractAgileUnDepositItem item,MallUserInfo user) { + //如果是按合同,则按照铺来分 + if (unDeposit.getSettingMethod() == EnumRentContractAgilSettingMethod.BY_CONTRACT.getCode()) { + for (int i = 0 ; i < shopIdList.size(); i++) { + Long sid= shopIdList.get(i); + BigDecimal shoprate = shopAreaRateMap.get(sid); + String cusName = ""; + buildUnDepositBill(unDeposit,idWorker,unDeposit.getRentContractId(),fees,sid,cusName,start,end,receiveDate,needpay,item.getRentArea(),user); + + } + }else { + + + for (int i = 0 ; i < shopIdList.size(); i++) { + Long sid= shopIdList.get(i); + BigDecimal shoprate = shopAreaRateMap.get(sid); + String cusName = ""; + buildUnDepositBill(unDeposit,idWorker,unDeposit.getRentContractId(),fees,item.getShopId(),cusName,start,end,receiveDate,needpay,item.getRentArea(),user); + + } + } + return wxBillRent; + } + + private WxAllBill buildUnDepositBill(TenantEntity tenantEntity,final IdWorker idWorker,Long rentContractId,WxEnergyFees fees, + Long shopId,String cusName,Date start,Date end,Date receiveDate,String needpay,String rentArea,MallUserInfo user) { WxAllBill wxBillRent = new WxAllBill(); wxBillRent.setIsPreview(EnumYesOrNo.YES.getCode()); wxBillRent.setId(idWorker.nextId()); - wxBillRent.setRentContractId(unDeposit.getRentContractId()); + wxBillRent.setRentContractId(rentContractId); wxBillRent.setRentContractAgileFeesType(EnumRentContractAgileFeesType.UN_DEPOSIT.getCode()); wxBillRent.setEnergyFeesId(fees.getId()); wxBillRent.setBillType(fees.getBillType()); @@ -527,10 +554,10 @@ public class WxAgileContractServiceImpl implements WxAgileContractService { wxBillRent.setReceivePay(needpay); //截止收租日在当前时间之前 Date date = new Date(); - wxBillRent.updateTenantInfo(unDeposit); - wxBillRent.setShopId(item.getShopId()); - wxBillRent.setCusName(shopNumber); - wxBillRent.setRentArea(item.getRentArea()); + wxBillRent.updateTenantInfo(tenantEntity); + wxBillRent.setShopId(shopId); + wxBillRent.setCusName(cusName); + wxBillRent.setRentArea(rentArea); wxBillRent.setCreatetime(date); wxBillRent.setCreateBy(user.getId()); wxBillRent.setCreateByName(user.getName()); 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 654b98e16..bf87e176d 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -595,7 +595,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { final IdWorker idWorker = IdWorker.get(); List shopIds = record.shopIdsByRentInfo(); //根据关联的店铺面积来分金额 - Map shopAreaRateMap = record.getRentShopAreaRate(); + Map shopAreaRateMap = record.getRentShopArea(); if (null == shopAreaRateMap) { throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"无店铺信息"); } @@ -640,7 +640,9 @@ public class WxRentContractServiceImpl implements WxRentContractService { for (int i = 0 ; i < shopIds.size(); i ++) { WxAllBill b = new WxAllBill(); Long sid = shopIds.get(i); - BigDecimal shoprate = shopAreaRateMap.get(sid); + BigDecimal shoprentArea = shopAreaRateMap.get(sid); + BigDecimal shoprate = shoprentArea.divide(new BigDecimal(record.getRentArea()),record.getDecimalSize(),BigDecimal.ROUND_HALF_UP); + try { BeanUtils.copyProperties(b, bill); b.setId(idWorker.nextId()); @@ -686,7 +688,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { int count = 1; List shopIds = record.shopIdsByRentInfo(); //根据关联的店铺面积来分金额 - Map shopAreaRateMap = record.getRentShopAreaRate(); + Map shopAreaRateMap = record.getRentShopArea(); if (null == shopAreaRateMap) { throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"无店铺信息"); } @@ -710,7 +712,9 @@ public class WxRentContractServiceImpl implements WxRentContractService { } for (int i = 0 ; i < shopIds.size(); i ++) { Long sid = shopIds.get(i); - BigDecimal shoprate = shopAreaRateMap.get(sid); + BigDecimal shoprentArea = shopAreaRateMap.get(sid); + BigDecimal shoprate = shoprentArea.divide(new BigDecimal(record.getRentArea()),record.getDecimalSize(),BigDecimal.ROUND_HALF_UP); + WxAllBill bill = new WxAllBill(); bill.setId(idWorker.nextId()); Date date = new Date(); @@ -903,7 +907,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { //根据不同的科目生成不同的押金账单 Map feesMap = wxRentContract.getDepositEnergyFees(typeMap); - Map shopAreaRateMap = wxRentContract.getRentShopAreaRate(); + Map shopAreaRateMap = wxRentContract.getRentShopArea(); if (null == shopAreaRateMap) { throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"无店铺信息"); } @@ -917,7 +921,9 @@ public class WxRentContractServiceImpl implements WxRentContractService { for (int i = 0 ; i < shopIdList.size(); i++ ) { Long sid = shopIdList.get(i); - BigDecimal shoprate = shopAreaRateMap.get(sid); + BigDecimal shoprentArea = shopAreaRateMap.get(sid); + BigDecimal shoprate = shoprentArea.divide(new BigDecimal(wxRentContract.getRentArea()),wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP); + WxAllBill wxBillDeposit = new WxAllBill(); wxBillDeposit.setId(idWorker.nextId()); wxBillDeposit.setRentContractId(wxRentContract.getId()); @@ -1238,7 +1244,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { } List shopIdList = wxRentContract.shopIdsByRentInfo(); - Map shopAreaRateMap = wxRentContract.getRentShopAreaRate(); + Map shopAreaRateMap = wxRentContract.getRentShopArea(); if (null == shopAreaRateMap) { throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"无店铺信息"); } @@ -1453,7 +1459,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { for (int g = 0 ; g < shopIdList.size(); g ++ ){ WxAllBill rs = new WxAllBill(); Long sid = shopIdList.get(g); - BigDecimal shoprate = shopAreaRateMap.get(sid); + BigDecimal shoprentArea = shopAreaRateMap.get(sid); + BigDecimal shoprate = shoprentArea.divide(new BigDecimal(wxRentContract.getRentArea()),wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP); try { BeanUtils.copyProperties(rs, rb); rs.setId(idWorker.nextId()); @@ -1485,7 +1492,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { for (int g = 0 ; g < shopIdList.size(); g ++ ){ WxAllBill rs = new WxAllBill(); Long sid = shopIdList.get(g); - BigDecimal shoprate = shopAreaRateMap.get(sid); + BigDecimal shoprentArea = shopAreaRateMap.get(sid); + BigDecimal shoprate = shoprentArea.divide(new BigDecimal(wxRentContract.getRentArea()),wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP); try { BeanUtils.copyProperties(rs, rb); rs.setId(idWorker.nextId()); @@ -2756,7 +2764,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { } List shopIdList = rentcontract.shopIdsByRentInfo(); - Map shopAreaRateMap = rentcontract.getRentShopAreaRate(); + Map shopAreaRateMap = rentcontract.getRentShopArea(); WxShopUsers suq = new WxShopUsers(); suq.updateTenantInfo(rentcontract); suq.setShopIds(shopIdList); @@ -2813,7 +2821,9 @@ public class WxRentContractServiceImpl implements WxRentContractService { List billList = new ArrayList(); for (int i = 0 ; i < shopIds.size(); i++) { Long sid = shopIds.get(i); - BigDecimal shoprate = shopAreaRateMap.get(sid); + BigDecimal shoprentArea = shopAreaRateMap.get(sid); + BigDecimal shoprate = shoprentArea.divide(new BigDecimal(rentcontract.getRentArea()),rentcontract.getDecimalSize(),BigDecimal.ROUND_HALF_UP); + String newmoney = new BigDecimal(bussinessmoney).multiply(shoprate).setScale(rentcontract.getDecimalSize()).toPlainString(); WxAllBill b = new WxAllBill(); final IdWorker idWorker = IdWorker.get(); @@ -2862,7 +2872,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { List billList = new ArrayList(); for (int i = 0 ; i < shopIds.size() ; i ++) { Long sid = shopIds.get(i); - BigDecimal shoprate = shopAreaRateMap.get(sid); + BigDecimal shoprentArea = shopAreaRateMap.get(sid); + BigDecimal shoprate = shoprentArea.divide(new BigDecimal(rentcontract.getRentArea()),rentcontract.getDecimalSize(),BigDecimal.ROUND_HALF_UP); WxAllBill bmbill = new WxAllBill(); final IdWorker idWorker = IdWorker.get(); @@ -2902,7 +2913,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { List billList = new ArrayList(); for (int i = 0 ; i < shopIds.size(); i++) { Long sid = shopIds.get(i); - BigDecimal shoprate = shopAreaRateMap.get(sid); + BigDecimal shoprentArea = shopAreaRateMap.get(sid); + BigDecimal shoprate = shoprentArea.divide(new BigDecimal(rentcontract.getRentArea()),rentcontract.getDecimalSize(),BigDecimal.ROUND_HALF_UP); WxAllBill bmbill = new WxAllBill(); final IdWorker idWorker = IdWorker.get(); bmbill.setId(idWorker.nextId());