diff --git a/mallinkService/src/main/java/com/iformall/common/SysConfigConstant.java b/mallinkService/src/main/java/com/iformall/common/SysConfigConstant.java index 8ec72aabd..83ecf6b92 100644 --- a/mallinkService/src/main/java/com/iformall/common/SysConfigConstant.java +++ b/mallinkService/src/main/java/com/iformall/common/SysConfigConstant.java @@ -13,4 +13,5 @@ public class SysConfigConstant { public static final String bill_before_days = "billBeforeDays"; public static final String bill_near_days = "billNearDays"; public static final String finance_receive_end_date = "financeReceiveEndDate"; + public static final String rent_share_bill_rate = "rentsharebillrate"; } diff --git a/mallinkService/src/main/java/com/iformall/service/helper/WxRentContractHelper.java b/mallinkService/src/main/java/com/iformall/service/helper/WxRentContractHelper.java index c21bbd7e8..175808558 100644 --- a/mallinkService/src/main/java/com/iformall/service/helper/WxRentContractHelper.java +++ b/mallinkService/src/main/java/com/iformall/service/helper/WxRentContractHelper.java @@ -21,6 +21,7 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.iformall.domain.dto.NeedPayDTO; import com.iformall.domain.po.WxEnergyFees; +import com.iformall.domain.po.WxPropertyContract; import com.iformall.domain.po.WxRentContract; import com.iformall.domain.vo.WxBillFeesStandardsListVo; import com.iformall.enums.EnumContractReceivePeriodUnit; @@ -100,21 +101,66 @@ public class WxRentContractHelper { return null; } + public static String[] calcutePropertyPrice(WxPropertyContract wxPropertyContract) { + String adjustRatio = wxPropertyContract.getAdjustRatio(); + List integers = JSONArray.parseArray(adjustRatio, Integer.class); + integers.add(0, 0); + int size = integers.size(); + String[] priceArr = new String[size]; + priceArr[0] = wxPropertyContract.getPrice(); + //判断年租金调整方式 + if (wxPropertyContract.getAdjustRatioWay().equals(EnumRentContractAdjustRatioWay.RATIO.getCode())) { + BigDecimal priceD = new BigDecimal(wxPropertyContract.getPrice()); + for (int i = 1; i < size; i++) { + priceD = priceD.add(priceD.multiply(new BigDecimal(integers.get(i))).divide(new BigDecimal(10000))); + priceArr[i] = priceD.setScale(Constant.default_long_decimal_size, RoundingMode.HALF_EVEN).toPlainString(); + } + } else if (wxPropertyContract.getAdjustRatioWay().equals(EnumRentContractAdjustRatioWay.MONEY.getCode())) { + BigDecimal priceD = new BigDecimal(wxPropertyContract.getPrice()); + for (int i = 1; i < size; i++) { + priceD = priceD.add(new BigDecimal(integers.get(i)).divide(new BigDecimal(100))); + priceArr[i] = priceD.setScale(Constant.default_long_decimal_size, RoundingMode.HALF_EVEN).toPlainString(); + } + }else if (wxPropertyContract.getAdjustRatioWay().equals(EnumRentContractAdjustRatioWay.CUSTOM.getCode())){ + for (int i = 1; i < size; i++) { + priceArr[i] = new BigDecimal(integers.get(i)).divide(new BigDecimal(100)).setScale(Constant.default_long_decimal_size, RoundingMode.HALF_UP).toPlainString(); + } + }else { + for (int i = 1; i < size; i++) { + priceArr[i] = wxPropertyContract.getPrice(); + } + } + //物业没有4 +// }else if (wxPropertyContract.getAdjustRatioWay().equals(EnumRentContractAdjustRatioWay.FIX_RATIO.getCode())){ +// BigDecimal priceD = new BigDecimal(price); +// for (int i = 1; i < size; i++) { +// priceArr[i] = priceD.multiply(new BigDecimal(integers.get(i))).divide(new BigDecimal(100)).toPlainString(); +// } +// } + return priceArr; + } + //计算年租金 public static String[] calcuteRentPrice(WxRentContract wxRentContract) { if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_AREA.getCode()) || wxRentContract.getType().equals(EnumRentContractType.RENT_BY_AREA_AND_JOINT.getCode())) { if (wxRentContract.getRentInputWay().equals(EnumRentContractRentInputWay.PART.getCode())) { - //计算每年租金基数(按面积,分铺录入) - //第一年 - List priceList = computeRentPriceByShop(wxRentContract); - return calcuteRatioByPart(priceList, "adjustRatio"); +// //计算每年租金基数(按面积,分铺录入) +// //第一年 +// List priceList = computeRentPriceByShop(wxRentContract); +// return calcuteRatioByPart(priceList, "adjustRatio"); }else { - return calcuteRentPriceByJoin(wxRentContract); + List priceList = calcuteRentPriceByJoin(wxRentContract,true); + return priceList.get(0); } } - return calcuteRentPriceByJoin(wxRentContract); + List priceList = calcuteRentPriceByJoin(wxRentContract,true); + return priceList.get(0); + } + + public static List calcuteRentAndRevenuePrice(WxRentContract wxRentContract) { + return calcuteRentPriceByJoin(wxRentContract,false); } //计算单个店铺每年租金基数(分铺录入) @@ -133,7 +179,8 @@ public class WxRentContractHelper { } //计算每年租金基数值(合铺录入),具体计算在合同创建时,会根据合同的PriceUnit来根据此基数来计算 - private static String[] calcuteRentPriceByJoin(WxRentContract wxRentContract) { + private static List calcuteRentPriceByJoin(WxRentContract wxRentContract,boolean isCalcuted) { + List retList = new ArrayList(); //租金的年调整 String adjustRatio = wxRentContract.getAdjustRatio(); List integers = JSONArray.parseArray(adjustRatio, Integer.class); @@ -213,7 +260,7 @@ public class WxRentContractHelper { } } - + if (isCalcuted) { //租金和联营取高 if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_AREA_AND_JOINT.getCode())) { if (null != revenuePriceArrs) { @@ -224,8 +271,12 @@ public class WxRentContractHelper { } } } - - return priceArrs; + } + retList.add(priceArrs); + if (!isCalcuted && null != revenuePriceArrs) { + retList.add(revenuePriceArrs); + } + return retList; } //联营面积取高计算联营扣点调整。 diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java index 25b46e908..79793b7bd 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java @@ -592,8 +592,8 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService return JSONObject.toJSONString(shopInfo); } - public List buildRentMonth(WxMerchant wxMerchant, MallUserInfo user,WxPropertyContract wxPropertyContract, int receivePeriod, Integer lease, Date rentalStartDate, String price, Integer isPreview,boolean saveDb) { - String adjustRatio = wxPropertyContract.getAdjustRatio(); + public List buildRentMonth(WxMerchant wxMerchant, MallUserInfo user,WxPropertyContract wxPropertyContract, int receivePeriod, Integer lease, Date rentalStartDate,Integer isPreview,boolean saveDb) { + // Map shopInfo = new HashMap<>(); if (wxPropertyContract.getCreateType().intValue() == EnumPropertyCreateType.BY_SHOP.getCode().intValue()) { List shopids = wxPropertyContract.shopIdsByShop(); @@ -619,42 +619,9 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService } } - List integers = JSONArray.parseArray(adjustRatio, Integer.class); - integers.add(0, 0); - int size = integers.size(); - String[] priceArr = new String[size]; - priceArr[0] = price; - //判断年租金调整方式 - if (wxPropertyContract.getAdjustRatioWay().equals(EnumRentContractAdjustRatioWay.RATIO.getCode())) { - BigDecimal priceD = new BigDecimal(price); - for (int i = 1; i < size; i++) { - priceD = priceD.add(priceD.multiply(new BigDecimal(integers.get(i))).divide(new BigDecimal(10000))); - priceArr[i] = priceD.setScale(Constant.default_long_decimal_size, RoundingMode.HALF_EVEN).toPlainString(); - } - } else if (wxPropertyContract.getAdjustRatioWay().equals(EnumRentContractAdjustRatioWay.MONEY.getCode())) { - BigDecimal priceD = new BigDecimal(price); - for (int i = 1; i < size; i++) { - priceD = priceD.add(new BigDecimal(integers.get(i)).divide(new BigDecimal(100))); - priceArr[i] = priceD.setScale(Constant.default_long_decimal_size, RoundingMode.HALF_EVEN).toPlainString(); - } - }else if (wxPropertyContract.getAdjustRatioWay().equals(EnumRentContractAdjustRatioWay.CUSTOM.getCode())){ - for (int i = 1; i < size; i++) { - priceArr[i] = new BigDecimal(integers.get(i)).divide(new BigDecimal(100)).setScale(Constant.default_long_decimal_size, RoundingMode.HALF_UP).toPlainString(); - } - }else { - for (int i = 1; i < size; i++) { - priceArr[i] = price; - } - } - //物业没有4 -// }else if (wxPropertyContract.getAdjustRatioWay().equals(EnumRentContractAdjustRatioWay.FIX_RATIO.getCode())){ -// BigDecimal priceD = new BigDecimal(price); -// for (int i = 1; i < size; i++) { -// priceArr[i] = priceD.multiply(new BigDecimal(integers.get(i))).divide(new BigDecimal(100)).toPlainString(); -// } -// } - - + String[] priceArr = WxRentContractHelper.calcutePropertyPrice(wxPropertyContract); + + int size = priceArr.length; int month = 12; int divide = lease / month; int mod = lease % month; @@ -1026,7 +993,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService String price = propertyContract.getPrice(); //按月计租 - result = buildRentMonth(wxMerchant, user, propertyContract, receivePeriod, lease, rentalStartDate, price,isPreview,saveDb); + result = buildRentMonth(wxMerchant, user, propertyContract, receivePeriod, lease, rentalStartDate,isPreview,saveDb); } //for (int i = 0; i < result.size(); i++) { // result.get(i).setPeriod(i+1); 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 2eacebe3b..9e21f84a9 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -9,7 +9,9 @@ import com.iformall.common.ErrorCode; import com.iformall.common.IdWorker; import com.iformall.common.Result; import com.iformall.common.ResultData; +import com.iformall.common.SysConfigConstant; import com.iformall.domain.po.MallUserInfo; +import com.iformall.domain.po.SysConfig; import com.iformall.domain.po.WxAllBill; import com.iformall.domain.po.WxEnergyFees; import com.iformall.domain.po.WxFlowModel; @@ -68,6 +70,7 @@ import com.iformall.mapper.WxRentContractMapper; import com.iformall.mapper.WxRentContractRevenueJumpMapper; import com.iformall.mapper.WxRentContractRevenueSalesMapper; import com.iformall.mapper.WxShopMapper; +import com.iformall.service.SysConfigService; import com.iformall.service.WxEnergyService; import com.iformall.service.WxFlowRecordService; import com.iformall.service.WxFlowService; @@ -204,6 +207,10 @@ public class WxRentContractServiceImpl implements WxRentContractService { @Autowired WxEnergyService wxEnergyService; + @Lazy + @Autowired + SysConfigService sysConfigService; + @Override public List findList(WxRentContract record){ return wxRentContractMapper.findList(record); @@ -2554,6 +2561,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { //加上物业 WxAllBill propertyBill = null; + BigDecimal propertyPrice = new BigDecimal(0); + WxPropertyContract propertyContract = null; if (null != propertyContractId) { WxAllBill propertyBillq = new WxAllBill(); propertyBillq.updateTenantInfo(rentcontract); @@ -2569,7 +2578,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { } } - //根据销售额来计算价格均值 + //根据销售额来计算平均每计费周期营业额,相当于设置联营扣点保底营业额 BigDecimal unitRevenuePrice = calcuteUnitPrice(rentBill.getStarttime(), rentBill.getEndtime(),salesDeciaml, rentcontract.getPriceUnit(),rentcontract.getDayPriceCalcute(),rentcontract.getMonthAverageDays(),rentcontract.getAdjustPeriod(),rentcontract.getReceivePeriodUnit()); //设置保底营业额 @@ -2581,22 +2590,27 @@ public class WxRentContractServiceImpl implements WxRentContractService { }else if (rentcontract.getType().intValue() == EnumRentContractType.RENT_BY_AREA_AND_JOINT.getCode()) { //取高才能加上物业费 if (null != propertyContractId && null != propertyBill) { - WxPropertyContract propertyContract = wxPropertyContractMapper.selectById(propertyContractId); - BigDecimal rentPrice = new BigDecimal(rentcontract.getPrice()); + propertyContract = wxPropertyContractMapper.selectById(propertyContractId); //有可能物业的单价时间跟租金的不一致,需要根据物业的单价重新计算 - BigDecimal propertyPrice = calcuteRentPropertyPrice(rentcontract, propertyContract, rentBill.getStarttime(), rentBill.getEndtime(), + propertyPrice = calcuteRentPropertyPrice(rentcontract, propertyContract, rentBill.getStarttime(), rentBill.getEndtime(), new BigDecimal(propertyBill.getNeedPay())); - - rentcontract.setPrice(rentPrice.add(propertyPrice).toPlainString());; } } //计算每一年的基数 - String[] priceArrs = WxRentContractHelper.calcuteRentPrice(rentcontract); + List priceArrs = WxRentContractHelper.calcuteRentAndRevenuePrice(rentcontract); + String[] rentPriceArrs = priceArrs.get(0); + String[] revenuePriceArrs = priceArrs.get(1); //计算商业管理费 String[] bussinessManagerPriceArrs = WxRentContractHelper.calcuteBussinessManagementFee(rentcontract); //计算运营管理费 String[] operationManagerPriceArrs = WxRentContractHelper.calcuteOperatingManagementFee(rentcontract); - List yearList = this.getYearList(priceArrs.length, 12, rentcontract.getRentalStartDate(),null); + + //物业费单价 + String[] propertyContractArrs = null; + if (null != propertyContract) { + propertyContractArrs = WxRentContractHelper.calcutePropertyPrice(propertyContract); + } + List 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); @@ -2608,10 +2622,61 @@ public class WxRentContractServiceImpl implements WxRentContractService { if (yearIndex <= 0 ) { yearIndex = 0; } - //免租期 + + //租金+营业管理费+商业管理费+物业 和扣点相比取高。 + BigDecimal rentTotal = new BigDecimal(rentPriceArrs[yearIndex]); + if (null != bussinessManagerPriceArrs) { + rentTotal = rentTotal.add(new BigDecimal(bussinessManagerPriceArrs[yearIndex])); + } + if (null != operationManagerPriceArrs) { + rentTotal = rentTotal.add(new BigDecimal(operationManagerPriceArrs[yearIndex])); + } + rentTotal = rentTotal.add(propertyPrice); + + //跟扣点相比较 + BigDecimal priceDecimal = rentTotal; + if (null != revenuePriceArrs) { + BigDecimal revenuePrice = new BigDecimal(revenuePriceArrs[yearIndex]); + if (revenuePrice.compareTo(rentTotal) > 0 ) { + priceDecimal = revenuePrice; + } + } + + //计算资金分摊的比例 租金,商业管理费,营业管理费,物业费。每个科目税点不一样,这样分摊能降低成本 + String[] moneyShareRates = new String[4]; + BigDecimal rentPriceDecimal = new BigDecimal(rentPriceArrs[yearIndex]); + BigDecimal bussinessPriceDecimal = new BigDecimal(bussinessManagerPriceArrs[yearIndex]); + BigDecimal operaterPriceDecimal = new BigDecimal(operationManagerPriceArrs[yearIndex]); + if (null != rentPriceArrs && null != bussinessManagerPriceArrs && null != operationManagerPriceArrs + && rentPriceDecimal.compareTo(new BigDecimal(0)) > 0 && bussinessPriceDecimal.compareTo(new BigDecimal(0)) > 0 && operaterPriceDecimal.compareTo(new BigDecimal(0)) > 0) { + BigDecimal total = rentPriceDecimal.add(bussinessPriceDecimal).add(operaterPriceDecimal); + BigDecimal property = new BigDecimal(0); + if (null != propertyContractArrs) { + property = new BigDecimal(propertyContractArrs[yearIndex]); + } + total = total.add(property); + moneyShareRates[0] = rentPriceDecimal.divide(total,Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP).toPlainString(); + moneyShareRates[1] = bussinessPriceDecimal.divide(total,Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP).toPlainString(); + moneyShareRates[2] = operaterPriceDecimal.divide(total,Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP).toPlainString(); + moneyShareRates[3] = property.divide(total,Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP).toPlainString(); + }else { + SysConfig shareConfig = sysConfigService.getByKey(SysConfigConstant.rent_share_bill_rate, rentcontract); + if (null == shareConfig || StringUtils.isBlank(shareConfig.getConfigItemValue())) { + throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"系统配置"+SysConfigConstant.rent_share_bill_rate+"未配置。"); + } + moneyShareRates = shareConfig.getConfigItemValue().split(","); + } + + + //免租期 List freePeriods = getFreeDays(rentcontract); - //根据租金和扣点来计算 - String rentNeedpay = WxRentContractHelper.getNeedPayMoney(freePeriods,rentcontract, priceArrs[yearIndex],rentBill.getStarttime(), + + //根据扣点规则和租赁相关费用取高来计算费用 + String needpay = WxRentContractHelper.getNeedPayMoney(freePeriods,rentcontract, priceDecimal.toPlainString(),rentBill.getStarttime(), + rentBill.getEndtime(),0,0,false,rentcontract.getReceivePeriodUnit(),rentcontract.getReceivePeriod()); + + //根据租金来计算 + String rentNeedpay = WxRentContractHelper.getNeedPayMoney(freePeriods,rentcontract, rentPriceArrs[yearIndex],rentBill.getStarttime(), rentBill.getEndtime(),0,0,false,rentcontract.getReceivePeriodUnit(),rentcontract.getReceivePeriod()); String bussinessNeedPay = "0"; @@ -2625,8 +2690,6 @@ public class WxRentContractServiceImpl implements WxRentContractService { rentBill.getEndtime(),0,0,false,rentcontract.getReceivePeriodUnit(),rentcontract.getReceivePeriod()); } - String needpay = new BigDecimal(rentNeedpay).add(new BigDecimal(bussinessNeedPay)).add(new BigDecimal(operationNeedPay)).toPlainString(); - //计算跳点。 BigDecimal[] jumppays = calcuteReveneuJump(salesDeciaml, rentcontract,rentBill.getStarttime(), rentBill.getEndtime(),freePeriods); BigDecimal jumpRevenuePay = jumppays[0]; @@ -2639,13 +2702,12 @@ public class WxRentContractServiceImpl implements WxRentContractService { } StringBuffer sb = new StringBuffer(); if (jumppay.compareTo(new BigDecimal(needpay)) > 0 ) { - sb.append("跳点规则计算金额:"+jumppay.toPlainString()+",合同租金扣点规则计算金额:"+needpay+".(其中包含租金:"+rentNeedpay+",商业管理费:"+bussinessNeedPay+",营运管理费:"+operationNeedPay+")"); + sb.append("跳点规则计算金额:"+jumppay.toPlainString()+",合同租金扣点规则计算金额:"+needpay+".(其中包含租金:"+rentNeedpay+",商业管理费:"+bussinessNeedPay+",营运管理费:"+operationNeedPay+",物业费:"+propertyPrice.toPlainString()+")"); needpay = jumppay.toPlainString(); }else { - sb.append("跳点规则计算金额:"+jumppay.toPlainString()+",合同租金扣点规则计算金额:"+needpay+".(其中包含租金:"+rentNeedpay+",商业管理费:"+bussinessNeedPay+",营运管理费:"+operationNeedPay+")"); + sb.append("跳点规则计算金额:"+jumppay.toPlainString()+",合同租金扣点规则计算金额:"+needpay+".(其中包含租金:"+rentNeedpay+",商业管理费:"+bussinessNeedPay+",营运管理费:"+operationNeedPay+",物业费:"+propertyPrice.toPlainString()+")"); } - //保存销售额 WxRentContractRevenueSales rs = new WxRentContractRevenueSales(); rs.updateTenantInfo(rentcontract); @@ -2672,10 +2734,15 @@ public class WxRentContractServiceImpl implements WxRentContractService { wxRentContractRevenueSalesMapper.insert(sale); } + String rentRate = moneyShareRates[0]; + String bussinessRate = moneyShareRates[1]; + String operaterRate = moneyShareRates[2]; + String propertyRate = moneyShareRates[3]; //更新账单费用 - sb.append("原合同租金金额:"+rentBill.getNeedPay()+"元,计算之后为:"+needpay+"元。"); + String rentneedpay = new BigDecimal(needpay).multiply(new BigDecimal(rentRate)).setScale(rentcontract.getDecimalSize(),BigDecimal.ROUND_HALF_UP).toPlainString(); + sb.append("原合同租金金额:"+rentBill.getNeedPay()+"元,计算之后为:"+rentneedpay+"元。"); rentBill.setMoneyChangeDetail(sb.toString()); - rentBill.setReceivePay(needpay); + rentBill.setReceivePay(rentneedpay); rentBill.setBillRemark("设置销售额,自动计算"); rentBill.setUpdatetime(new Date()); if (new BigDecimal(rentBill.getOwe()).compareTo(new BigDecimal(0)) < 0 ) { @@ -2686,9 +2753,10 @@ public class WxRentContractServiceImpl implements WxRentContractService { wxAllBillMapper.updateById(rentBill); //物业账单应收就改为0,因为金额已经合并了 if (null != propertyBill) { - propertyBill.setMoneyChangeDetail("原合同物业金额:"+propertyBill.getNeedPay()+"元,已合并到租金,调整为:0元。"); - propertyBill.setReceivePay("0"); - propertyBill.setBillRemark("设置销售额,已自动计算合并到租金"); + String propertymoney = new BigDecimal(needpay).multiply(new BigDecimal(propertyRate)).setScale(rentcontract.getDecimalSize(),BigDecimal.ROUND_HALF_UP).toPlainString(); + propertyBill.setMoneyChangeDetail("原合同物业金额:"+propertyBill.getNeedPay()+"元,计算调整为:"+propertymoney+"元。"); + propertyBill.setReceivePay(propertymoney); + propertyBill.setBillRemark("设置销售额,自动计算"); if (new BigDecimal(propertyBill.getOwe()).compareTo(new BigDecimal(0)) < 0 ) { propertyBill.setStatus(EnumBillStatus.STOP_TO_SETTLE.getCode()); }else { @@ -2711,9 +2779,10 @@ public class WxRentContractServiceImpl implements WxRentContractService { WxAllBill bmbill = null; if (null != bmbillList && bmbillList.size() > 0 ) { bmbill = bmbillList.get(0); - bmbill.setMoneyChangeDetail("原合同商业管理费金额:"+bmbill.getNeedPay()+"元,已合并到租金,调整为:0元。"); - bmbill.setReceivePay("0"); - bmbill.setBillRemark("设置销售额,已自动计算合并到租金"); + String bussinessmoney = new BigDecimal(needpay).multiply(new BigDecimal(bussinessRate)).setScale(rentcontract.getDecimalSize(),BigDecimal.ROUND_HALF_UP).toPlainString(); + bmbill.setMoneyChangeDetail("原合同商业管理费金额:"+bmbill.getNeedPay()+"元,计算调整为:"+bussinessmoney+"元。"); + bmbill.setReceivePay(bussinessmoney); + bmbill.setBillRemark("设置销售额,自动计算"); if (new BigDecimal(bmbill.getOwe()).compareTo(new BigDecimal(0)) < 0 ) { bmbill.setStatus(EnumBillStatus.STOP_TO_SETTLE.getCode()); }else { @@ -2735,9 +2804,10 @@ public class WxRentContractServiceImpl implements WxRentContractService { WxAllBill ombill = null; if (null != ombillList && ombillList.size() > 0 ) { ombill = ombillList.get(0); - ombill.setMoneyChangeDetail("原合同营业管理费金额:"+bmbill.getNeedPay()+"元,已合并到租金,调整为:0元。"); - ombill.setReceivePay("0"); - ombill.setBillRemark("设置销售额,已自动计算合并到租金"); + String operatermoney = new BigDecimal(needpay).multiply(new BigDecimal(operaterRate)).setScale(rentcontract.getDecimalSize(),BigDecimal.ROUND_HALF_UP).toPlainString(); + ombill.setMoneyChangeDetail("原合同营业管理费金额:"+bmbill.getNeedPay()+"元,计算调整为:"+operatermoney+"元。"); + ombill.setReceivePay(operatermoney); + ombill.setBillRemark("设置销售额,自动计算"); if (new BigDecimal(ombill.getOwe()).compareTo(new BigDecimal(0)) < 0 ) { ombill.setStatus(EnumBillStatus.STOP_TO_SETTLE.getCode()); }else {