From 60fda0a5e4c44f20258be90b7b23e853f6ed7c7d Mon Sep 17 00:00:00 2001 From: luozukai Date: Wed, 31 Jul 2019 16:11:40 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=90=88=E5=90=8C][=E4=BF=AE=E6=94=B9][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A2=84=E8=B4=A6=E5=8D=95=E7=94=9F=E6=88=90?= =?UTF-8?q?=E9=80=BB=E8=BE=91]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/WxPropertyContractServiceImpl.java | 14 ++++++++++---- .../service/impl/WxRentContractServiceImpl.java | 14 ++++++++++---- 2 files changed, 20 insertions(+), 8 deletions(-) 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 f22edd0c3..508758a7c 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java @@ -652,8 +652,8 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService }else{ //如果是计算账单金额&cross 拆分日期进行计算 if(!saveDb && billTimeVo.getEndDate().after(endDate)) { - long needpayFront = getNeedPayMoney(wxPropertyContract,priceArrs[index-1],billTimeVo.getStartDate(),DateUtils.getDaySet(endDate,Calendar.DATE,-1),i,billTimeVoList.size()); - long needpayAfter = getNeedPayMoney(wxPropertyContract,priceArrs[index],endDate,billTimeVo.getEndDate(),i,billTimeVoList.size()); + long needpayFront = getNeedPayMoney(wxPropertyContract,priceArrs[index-1],billTimeVo.getStartDate(),DateUtils.getDaySet(endDate,Calendar.DATE,-1),i,billTimeVoList.size(),saveDb); + long needpayAfter = getNeedPayMoney(wxPropertyContract,priceArrs[index],endDate,billTimeVo.getEndDate(),i,billTimeVoList.size(),saveDb); System.out.println(); needpay = needpayFront+needpayAfter; flag = true; @@ -669,7 +669,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService //计算金额 if(!flag){ - needpay = getNeedPayMoney(wxPropertyContract, priceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size()); + needpay = getNeedPayMoney(wxPropertyContract, priceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(),saveDb); } WxBillProperty wxBillProperty = new WxBillProperty(); @@ -713,7 +713,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService return resultMap; } - public long getNeedPayMoney(WxPropertyContract wxRentContract,long price,Date startDate,Date endDate,int i,int billTimeVoListSize){ + public long getNeedPayMoney(WxPropertyContract wxRentContract,long price,Date startDate,Date endDate,int i,int billTimeVoListSize,boolean saveDb){ long needpay; //按日 if (wxRentContract.getPriceUnit().equals(EnumPriceUnit.D.getCode())){ @@ -727,6 +727,12 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService priceD = new Double(price)/12; } + //生成金额直接计算 + if(!saveDb){ + needpay = new Double(WxRentContractServiceImpl.getMonthNeedPay(priceD, startDate, endDate)).longValue(); + return needpay; + } + SimpleDateFormat sdMR = new SimpleDateFormat("MM-dd"); SimpleDateFormat sdM = new SimpleDateFormat("yyyy-MM"); if(i == billTimeVoListSize - 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 5b8f867a8..6338efd81 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -1044,8 +1044,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { }else{ //如果是计算账单金额&cross 拆分日期进行计算 if(!saveDb && billTimeVo.getEndDate().after(endDate)) { - long needpayFront = getNeedPayMoney(wxRentContract,priceArrs[index-1],billTimeVo.getStartDate(),DateUtils.getDaySet(endDate,Calendar.DATE,-1),i,billTimeVoList.size()); - long needpayAfter = getNeedPayMoney(wxRentContract,priceArrs[index],endDate,billTimeVo.getEndDate(),i,billTimeVoList.size()); + long needpayFront = getNeedPayMoney(wxRentContract,priceArrs[index-1],billTimeVo.getStartDate(),DateUtils.getDaySet(endDate,Calendar.DATE,-1),i,billTimeVoList.size(),saveDb); + long needpayAfter = getNeedPayMoney(wxRentContract,priceArrs[index],endDate,billTimeVo.getEndDate(),i,billTimeVoList.size(),saveDb); System.out.println(); needpay = needpayFront+needpayAfter; flag = true; @@ -1061,7 +1061,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { //计算金额 if(!flag){ - needpay = getNeedPayMoney(wxRentContract, priceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size()); + needpay = getNeedPayMoney(wxRentContract, priceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(),saveDb); } WxBillRent wxBillRent = new WxBillRent(); @@ -1105,7 +1105,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { return resultMap; } - public long getNeedPayMoney(WxRentContract wxRentContract,long price,Date startDate,Date endDate,int i,int billTimeVoListSize){ + public long getNeedPayMoney(WxRentContract wxRentContract,long price,Date startDate,Date endDate,int i,int billTimeVoListSize,boolean saveDb){ long needpay; //按日 if (wxRentContract.getPriceUnit().equals(EnumPriceUnit.D.getCode())){ @@ -1119,6 +1119,12 @@ public class WxRentContractServiceImpl implements WxRentContractService { priceD = new Double(price)/12; } + //生成金额直接计算 + if(!saveDb){ + needpay = new Double(getMonthNeedPay(priceD, startDate, endDate)).longValue(); + return needpay; + } + SimpleDateFormat sdMR = new SimpleDateFormat("MM-dd"); SimpleDateFormat sdM = new SimpleDateFormat("yyyy-MM"); if(i == billTimeVoListSize - 1){//最后